trim the space to input segment

This commit is contained in:
Lion 2022-12-05 20:38:59 +08:00
parent 7ff7772e14
commit 8e3c440ada

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)
}