Skip to content

Commit

Permalink
Merge pull request #46 from tom-wegener/master
Browse files Browse the repository at this point in the history
fix prefixes and metrics as uint8 to uint32
  • Loading branch information
mullerch authored Jan 24, 2025
2 parents 610197d + f652429 commit bcf5cd1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions IP4Config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type IP4Address struct {

type IP4AddressData struct {
Address string
Prefix uint8
Prefix uint32
}

// Deprecated: use IP4RouteData instead
Expand All @@ -48,9 +48,9 @@ type IP4Route struct {

type IP4RouteData struct {
Destination string
Prefix uint8
Prefix uint32
NextHop string
Metric uint8
Metric uint32
AdditionalAttributes map[string]string
}

Expand Down Expand Up @@ -151,7 +151,7 @@ func (c *ip4Config) GetPropertyAddressData() ([]IP4AddressData, error) {

ret[i] = IP4AddressData{
Address: address,
Prefix: uint8(prefix),
Prefix: prefix,
}
}

Expand Down Expand Up @@ -208,7 +208,7 @@ func (c *ip4Config) GetPropertyRouteData() ([]IP4RouteData, error) {
if !ok {
return routes, errors.New("unexpected variant type for prefix")
}
route.Prefix = uint8(prefix)
route.Prefix = prefix
case "next-hop":
nextHop, ok := routeDataAttribute.Value().(string)
if !ok {
Expand All @@ -220,7 +220,7 @@ func (c *ip4Config) GetPropertyRouteData() ([]IP4RouteData, error) {
if !ok {
return routes, errors.New("unexpected variant type for metric")
}
route.Metric = uint8(metric)
route.Metric = metric
default:
if route.AdditionalAttributes == nil {
route.AdditionalAttributes = make(map[string]string)
Expand Down
12 changes: 6 additions & 6 deletions IP6Config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type IP6Address struct {

type IP6AddressData struct {
Address string
Prefix uint8
Prefix uint32
}

// Deprecated: use IP6RouteData instead
Expand All @@ -45,9 +45,9 @@ type IP6Route struct {

type IP6RouteData struct {
Destination string
Prefix uint8
Prefix uint32
NextHop string
Metric uint8
Metric uint32
AdditionalAttributes map[string]string
}

Expand Down Expand Up @@ -110,7 +110,7 @@ func (c *ip6Config) GetPropertyAddressData() ([]IP6AddressData, error) {

ret[i] = IP6AddressData{
Address: address,
Prefix: uint8(prefix),
Prefix: prefix,
}
}

Expand Down Expand Up @@ -146,7 +146,7 @@ func (c *ip6Config) GetPropertyRouteData() ([]IP6RouteData, error) {
if !ok {
return routes, errors.New("unexpected variant type for prefix")
}
route.Prefix = uint8(prefix)
route.Prefix = prefix
case "next-hop":
nextHop, ok := routeDataAttribute.Value().(string)
if !ok {
Expand All @@ -158,7 +158,7 @@ func (c *ip6Config) GetPropertyRouteData() ([]IP6RouteData, error) {
if !ok {
return routes, errors.New("unexpected variant type for metric")
}
route.Metric = uint8(metric)
route.Metric = metric
default:
if route.AdditionalAttributes == nil {
route.AdditionalAttributes = make(map[string]string)
Expand Down

0 comments on commit bcf5cd1

Please sign in to comment.