github.com/slackhq/nebula@v1.9.0/calculated_remote_test.go (about) 1 package nebula 2 3 import ( 4 "net" 5 "testing" 6 7 "github.com/slackhq/nebula/iputil" 8 "github.com/stretchr/testify/assert" 9 "github.com/stretchr/testify/require" 10 ) 11 12 func TestCalculatedRemoteApply(t *testing.T) { 13 _, ipNet, err := net.ParseCIDR("192.168.1.0/24") 14 require.NoError(t, err) 15 16 c, err := newCalculatedRemote(ipNet, 4242) 17 require.NoError(t, err) 18 19 input := iputil.Ip2VpnIp([]byte{10, 0, 10, 182}) 20 21 expected := &Ip4AndPort{ 22 Ip: uint32(iputil.Ip2VpnIp([]byte{192, 168, 1, 182})), 23 Port: 4242, 24 } 25 26 assert.Equal(t, expected, c.Apply(input)) 27 }