ouitools.go
func ParseOUI(s string, size int) (hw HardwareAddr, err error) {
	if s[2] == ':' || s[2] == '-' {
		if (len(s)+1)%3 != 0 {
			goto error
		}

		n := (len(s) + 1) / 3

		hw = make(HardwareAddr, size)
		for x, i := 0, 0; i < n; i++ {
			var ok bool
			if hw[i], ok = xtoi2(s[x:], s[2]); !ok {
				goto error
			}
			x += 3
		}
	} else {
		goto error
	}
	return hw, nil

error:
	return nil, ErrInvalidMACAddress
}
func ParseOUI(s string, size int) (hw HardwareAddr, err error) {
	if s[2] == ':' || s[2] == '-' {
		if (len(s)+1)%3 != 0 {
			goto error
		}

		n := (len(s) + 1) / 3

		hw = make(HardwareAddr, size)
		for x, i := 0, 0; i < n; i++ {
			var ok bool
			if hw[i], ok = xtoi2(s[x:], s[2]); !ok {
				goto error
			}
			x += 3
		}
	} else {
		goto error
	}
	return hw, nil

error:
	return nil, ErrInvalidMACAddress
}
func ParseOUI ( s string , size int ) ( hw HardwareAddr , err error ) { if s [ 2 ] == ':' || s [ 2 ] == '-' { if ( len ( s ) + 1 ) % 3 != 0 { goto error } n := ( len ( s ) + 1 ) / 3 hw = make ( HardwareAddr , size ) for x , i := 0 , 0 ; i < n ; i ++ { var ok bool if hw [ i ] , ok = xtoi2 ( s [ x : ] , s [ 2 ] ) ; ! ok { goto error } x += 3 } } else { goto error } return hw , nil error : return nil , ErrInvalidMACAddress }
// ParseMAC parses s as an IEEE 802 MAC-48, EUI-48, or EUI-64 using one of the
// following formats:
//   01:23:45:67:89:ab
//   01:23:45:67:89:ab:cd:ef
//   01-23-45-67-89-ab
//   01-23-45-67-89-ab-cd-ef
//   0123.4567.89ab
//   0123.4567.89ab.cdef
ParseMAC parses s as an IEEE 802 MAC - 48 EUI - 48 or EUI - 64 using one of the following formats : 01 : 23 : 45 : 67 : 89 : ab 01 : 23 : 45 : 67 : 89 : ab : cd : ef 01 - 23 - 45 - 67 - 89 - ab 01 - 23 - 45 - 67 - 89 - ab - cd - ef 0123 . 4567 . 89ab 0123 . 4567 . 89ab . cdef