diff options
Diffstat (limited to 'packet')
-rw-r--r-- | packet/bgp.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/packet/bgp.go b/packet/bgp.go index c3f43bdb..2f246951 100644 --- a/packet/bgp.go +++ b/packet/bgp.go @@ -863,14 +863,10 @@ func GetRouteDistinguisher(data []byte) RouteDistinguisherInterface { func parseRdAndRt(input string) ([]string, error) { exp := regexp.MustCompile("^((\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)|((\\d+)\\.)?(\\d+)):(\\d+)$") - group := exp.FindSubmatch([]byte(input)) - if len(group) != 10 { + elems := exp.FindStringSubmatch(input) + if len(elems) != 10 { return nil, fmt.Errorf("failed to parse") } - elems := make([]string, 0, len(group)) - for _, elem := range group { - elems = append(elems, string(elem)) - } return elems, nil } |