MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / AddIPElement

Method AddIPElement

internal/firewalls/nftables/set.go:128–139  ·  view source on GitHub ↗
(ip string, options *ElementOptions, overwrite bool)

Source from the content-addressed store, hash-verified

126}
127
128func (this *Set) AddIPElement(ip string, options *ElementOptions, overwrite bool) error {
129 var ipObj = net.ParseIP(ip)
130 if ipObj == nil {
131 return errors.New("invalid ip '" + ip + "'")
132 }
133
134 if utils.IsIPv4(ip) {
135 return this.AddElement(ipObj.To4(), options, overwrite)
136 } else {
137 return this.AddElement(ipObj.To16(), options, overwrite)
138 }
139}
140
141func (this *Set) DeleteElement(key []byte) error {
142 // if set element does not exist, we return immediately

Callers 1

updateAllowIPListMethod · 0.80

Calls 3

AddElementMethod · 0.95
IsIPv4Function · 0.92
ParseIPMethod · 0.80

Tested by

no test coverage detected