mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
Improve ASN parsing
This commit is contained in:
parent
82cdd1b419
commit
a88de1532c
1 changed files with 4 additions and 2 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/safing/portmaster/intel"
|
||||
)
|
||||
|
@ -48,9 +49,10 @@ func (ep *EndpointASN) String() string {
|
|||
|
||||
func parseTypeASN(fields []string) (Endpoint, error) {
|
||||
if asnRegex.MatchString(fields[1]) {
|
||||
asn, err := strconv.ParseUint(fields[1][2:], 10, 64)
|
||||
asnString := strings.TrimPrefix(fields[1], "AS")
|
||||
asn, err := strconv.ParseUint(asnString, 10, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse AS number %s", fields[1])
|
||||
return nil, fmt.Errorf("failed to parse AS number %s", asnString)
|
||||
}
|
||||
|
||||
ep := &EndpointASN{
|
||||
|
|
Loading…
Add table
Reference in a new issue