isle/go/nebula/nebula_test.go

44 lines
805 B
Go

package nebula
import (
"net"
)
var (
ip net.IP
ipNet *net.IPNet
caCredsA, caCredsB CACredentials
hostPubCredsA, hostPubCredsB HostPublicCredentials
hostPrivCredsA, hostPrivCredsB HostPrivateCredentials
)
func init() {
var err error
ip, ipNet, err = net.ParseCIDR("192.168.0.1/24")
if err != nil {
panic(err)
}
caCredsA, err = NewCACredentials("a.example.com", ipNet)
if err != nil {
panic(err)
}
caCredsB, err = NewCACredentials("b.example.com", ipNet)
if err != nil {
panic(err)
}
hostPubCredsA, hostPrivCredsA, err = NewHostCredentials(caCredsA, "foo", ip)
if err != nil {
panic(err)
}
hostPubCredsB, hostPrivCredsB, err = NewHostCredentials(caCredsB, "bar", ip)
if err != nil {
panic(err)
}
}