package main import ( `strconv` `strings` ) // Sizes returns a parsed/split slice of uint8s from a vlsmSize. func (v *vlsmSize) Sizes() (sizes []uint8, err error) { var s []string var u uint64 if v == nil { return } s = strings.Split(string(*v), ",") for idx, i := range s { s[idx] = strings.TrimSpace(i) } sizes = make([]uint8, len(s)) // No validation is performed since we don't have access to the addr inet family; that's up to the parsers. for idx, i := range s { if u, err = strconv.ParseUint(i, 10, 8); err != nil { return } sizes[idx] = uint8(u) } return }