lib/nat: Add a nat package and service to track mappings on multiple IGDs

This commit is contained in:
Audrius Butkevicius
2016-04-10 19:36:38 +00:00
committed by Jakob Borg
parent f3ac421266
commit 19b4f3bfb4
20 changed files with 661 additions and 236 deletions

View File

@@ -17,16 +17,6 @@ import (
// randomCharset contains the characters that can make up a randomString().
const randomCharset = "01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"
// PredictableRandom is an RNG that will always have the same sequence. It
// will be seeded with the device ID during startup, so that the sequence is
// predictable but varies between instances.
var PredictableRandom = mathRand.New(mathRand.NewSource(42))
func init() {
// The default RNG should be seeded with something good.
mathRand.Seed(RandomInt64())
}
// RandomString returns a string of random characters (taken from
// randomCharset) of the specified length.
func RandomString(l int) string {