X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=examples%2Funion-example%2Funion_example.go;h=92c3ec2446df98ed065544ab5ce01936f0824eed;hb=9f27eeff53ee501b8641595baa7cbc2f0014a68c;hp=22fb362fcd78e9a1e593be8c6a97a062aa2cbac0;hpb=d4d3b9c6fa67fe454f8d8adc7502b3b645ecab10;p=govpp.git diff --git a/examples/union-example/union_example.go b/examples/union-example/union_example.go index 22fb362..92c3ec2 100644 --- a/examples/union-example/union_example.go +++ b/examples/union-example/union_example.go @@ -22,6 +22,8 @@ import ( "net" "git.fd.io/govpp.git/examples/binapi/ip" + "git.fd.io/govpp.git/examples/binapi/ip_types" + "github.com/lunixbochs/struc" ) @@ -37,8 +39,8 @@ func encodingExample() { // use it in the Address type addr := &ip.Address{ - Af: ip.ADDRESS_IP4, - Un: ip.AddressUnionIP4(ip.IP4Address{192, 168, 1, 10}), + Af: ip_types.ADDRESS_IP4, + Un: ip_types.AddressUnionIP4(ip.IP4Address{192, 168, 1, 10}), } log.Printf("encoding union IPv4: %v", addr.Un.GetIP4()) @@ -89,12 +91,12 @@ func ipToAddress(ipstr string) (addr ip.Address, err error) { return ip.Address{}, fmt.Errorf("invalid IP: %q", ipstr) } if ip4 := netIP.To4(); ip4 == nil { - addr.Af = ip.ADDRESS_IP6 + addr.Af = ip_types.ADDRESS_IP6 var ip6addr ip.IP6Address copy(ip6addr[:], netIP.To16()) addr.Un.SetIP6(ip6addr) } else { - addr.Af = ip.ADDRESS_IP4 + addr.Af = ip_types.ADDRESS_IP4 var ip4addr ip.IP4Address copy(ip4addr[:], ip4) addr.Un.SetIP4(ip4addr)