package nebula

import "net/netip"

var (
	ip                             netip.Addr
	ipNet                          IPNet
	caCredsA, caCredsB             CACredentials
	hostPubCredsA, hostPubCredsB   HostPublicCredentials
	hostPrivCredsA, hostPrivCredsB HostPrivateCredentials
)

func init() {
	ip = netip.MustParseAddr("192.168.0.1")

	var err error
	if err := ipNet.UnmarshalText([]byte("192.168.0.0/24")); 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)
	}

}