Code: refresh code
This commit is contained in:
@ -23,6 +23,7 @@ func WithIPCIDRNoResolve(noResolve bool) IPCIDROption {
|
||||
type IPCIDR struct {
|
||||
ipnet *net.IPNet
|
||||
adapter string
|
||||
network C.NetWork
|
||||
isSourceIP bool
|
||||
noResolveIP bool
|
||||
}
|
||||
@ -54,7 +55,11 @@ func (i *IPCIDR) ShouldResolveIP() bool {
|
||||
return !i.noResolveIP
|
||||
}
|
||||
|
||||
func NewIPCIDR(s string, adapter string, opts ...IPCIDROption) (*IPCIDR, error) {
|
||||
func (i *IPCIDR) NetWork() C.NetWork {
|
||||
return i.network
|
||||
}
|
||||
|
||||
func NewIPCIDR(s string, adapter string, network C.NetWork, opts ...IPCIDROption) (*IPCIDR, error) {
|
||||
_, ipnet, err := net.ParseCIDR(s)
|
||||
if err != nil {
|
||||
return nil, errPayload
|
||||
@ -63,6 +68,7 @@ func NewIPCIDR(s string, adapter string, opts ...IPCIDROption) (*IPCIDR, error)
|
||||
ipcidr := &IPCIDR{
|
||||
ipnet: ipnet,
|
||||
adapter: adapter,
|
||||
network: network,
|
||||
}
|
||||
|
||||
for _, o := range opts {
|
||||
|
Reference in New Issue
Block a user