lib/nat: Add a nat package and service to track mappings on multiple IGDs
This commit is contained in:
committed by
Jakob Borg
parent
f3ac421266
commit
19b4f3bfb4
@@ -6,26 +6,7 @@
|
||||
|
||||
package util
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"sync"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var predictableRandomTest sync.Once
|
||||
|
||||
func TestPredictableRandom(t *testing.T) {
|
||||
if runtime.GOARCH != "amd64" {
|
||||
t.Skip("Test only for 64 bit platforms; but if it works there, it should work on 32 bit")
|
||||
}
|
||||
predictableRandomTest.Do(func() {
|
||||
// predictable random sequence is predictable
|
||||
e := int64(3440579354231278675)
|
||||
if v := int64(PredictableRandom.Int()); v != e {
|
||||
t.Errorf("Unexpected random value %d != %d", v, e)
|
||||
}
|
||||
})
|
||||
}
|
||||
import "testing"
|
||||
|
||||
func TestSeedFromBytes(t *testing.T) {
|
||||
// should always return the same seed for the same bytes
|
||||
|
||||
Reference in New Issue
Block a user