コード例 #1
0
ファイル: ip_overlay.go プロジェクト: jddixon/xlOverlay_go
func (o *IPOverlay) IsElement(e xt.EndPointI) bool {
	oT := o.Transport()
	eT := e.Transport()
	if !CompatibleTransports(oT, eT) {
		return false
	}

	eA := e.Address().String()
	parts := strings.Split(eA, ":")

	bs := net.ParseIP(parts[0]) // returns an IP, a []byte
	if bs == nil {
		fmt.Printf("could not parse '%s'\n", eA)
		return false
	}
	return o.addrRange.ipNet.Contains(bs)
}