diff options
Diffstat (limited to 'tunnel/tools/libwg-go')
-rw-r--r-- | tunnel/tools/libwg-go/dhcp.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tunnel/tools/libwg-go/dhcp.go b/tunnel/tools/libwg-go/dhcp.go index b7919151..4af5b0cb 100644 --- a/tunnel/tools/libwg-go/dhcp.go +++ b/tunnel/tools/libwg-go/dhcp.go @@ -12,6 +12,7 @@ import ( "github.com/insomniacslk/dhcp/iana" gen "golang.zx2c4.com/wireguard/android/gen" + "google.golang.org/protobuf/types/known/durationpb" ) const ( @@ -131,13 +132,13 @@ func getAddressesFromReply(reply *dhcpv6.Message) []*gen.Lease{ ianaOpts := iana.Options.Get(dhcpv6.OptionIAAddr) for _, opt := range ianaOpts { - addr :=opt.(*dhcpv6.OptIAAddress).IPv6Addr + addrOpt := opt.(*dhcpv6.OptIAAddress) lease := &gen.Lease{ Address: &gen.InetAddress{ - Address: addr, + Address: addrOpt.IPv6Addr, }, - // PreferredLifetime: , - // ValidLifetime: , + PreferredLifetime: durationpb.New(addrOpt.PreferredLifetime), + ValidLifetime: durationpb.New(addrOpt.ValidLifetime), } leases = append(leases, lease) } |