trim the space to input segment

This commit is contained in:
Lion 2022-12-05 20:38:59 +08:00
parent 5833f94ae5
commit e49e4b1230
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,7 @@ type Segment struct {
}
func SegmentFrom(seg string) (*Segment, error) {
var ps = strings.SplitN(seg, "|", 3)
var ps = strings.SplitN(strings.TrimSpace(seg), "|", 3)
if len(ps) != 3 {
return nil, fmt.Errorf("invalid ip segment `%s`", seg)
}