2022-10-29 19:11:40 +00:00
|
|
|
package nebula
|
|
|
|
|
2024-07-12 13:30:21 +00:00
|
|
|
import "net/netip"
|
2022-10-29 19:11:40 +00:00
|
|
|
|
|
|
|
var (
|
2024-07-12 13:30:21 +00:00
|
|
|
ip netip.Addr
|
|
|
|
ipNet IPNet
|
2024-06-10 20:31:29 +00:00
|
|
|
caCredsA, caCredsB CACredentials
|
|
|
|
hostPubCredsA, hostPubCredsB HostPublicCredentials
|
|
|
|
hostPrivCredsA, hostPrivCredsB HostPrivateCredentials
|
2022-10-29 19:11:40 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2024-07-12 13:30:21 +00:00
|
|
|
ip = netip.MustParseAddr("192.168.0.1")
|
2022-10-29 19:11:40 +00:00
|
|
|
|
2024-07-12 13:30:21 +00:00
|
|
|
var err error
|
|
|
|
if err := ipNet.UnmarshalText([]byte("192.168.0.0/24")); err != nil {
|
2022-10-29 19:11:40 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2024-06-10 20:31:29 +00:00
|
|
|
hostPubCredsA, hostPrivCredsA, err = NewHostCredentials(caCredsA, "foo", ip)
|
2022-10-29 19:11:40 +00:00
|
|
|
if err != nil {
|
2022-11-05 14:23:29 +00:00
|
|
|
panic(err)
|
2022-10-29 19:11:40 +00:00
|
|
|
}
|
|
|
|
|
2024-06-10 20:31:29 +00:00
|
|
|
hostPubCredsB, hostPrivCredsB, err = NewHostCredentials(caCredsB, "bar", ip)
|
2022-10-29 19:11:40 +00:00
|
|
|
if err != nil {
|
2022-11-05 14:23:29 +00:00
|
|
|
panic(err)
|
2022-10-29 19:11:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|