Skip to content

Commit be50510

Browse files
committed
Remove NextHop: SRH already contains it
1 parent 358297d commit be50510

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

jsonapi/action.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@
55
package jsonapi
66

77
type Action struct {
8-
NextHop NextHop
9-
SRH SRH
8+
SRH SRH `json:"srh"`
109
}

jsonapi/srh.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
// SPDX-License-Identifier: MIT
55
package jsonapi
66

7-
import "fmt"
7+
import (
8+
"fmt"
9+
"net"
10+
)
811

912
type SRH []*Segment
1013

@@ -22,3 +25,11 @@ func NewSRH(segments []string) (*SRH, error) {
2225
}
2326
return &srh, nil
2427
}
28+
29+
func (srh SRH) AsSlice() []net.IP {
30+
r := make([]net.IP, len(srh))
31+
for i, seg := range srh {
32+
r[i] = seg.AsSlice()
33+
}
34+
return r
35+
}

0 commit comments

Comments
 (0)