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

Method AddDropIPv4Rule

internal/firewalls/nftables/chain.go:101–121  ·  view source on GitHub ↗
(ip []byte, userData []byte)

Source from the content-addressed store, hash-verified

99}
100
101func (this *Chain) AddDropIPv4Rule(ip []byte, userData []byte) (*Rule, error) {
102 return this.AddRule(&RuleOptions{
103 Exprs: []expr.Any{
104 &expr.Payload{
105 DestRegister: 1,
106 Base: expr.PayloadBaseNetworkHeader,
107 Offset: 12,
108 Len: 4,
109 },
110 &expr.Cmp{
111 Op: expr.CmpOpEq,
112 Register: 1,
113 Data: ip,
114 },
115 &expr.Verdict{
116 Kind: expr.VerdictDrop,
117 },
118 },
119 UserData: userData,
120 })
121}
122
123func (this *Chain) AddDropIPv6Rule(ip []byte, userData []byte) (*Rule, error) {
124 return this.AddRule(&RuleOptions{

Callers 1

TestChain_AddDropIPRuleFunction · 0.80

Calls 1

AddRuleMethod · 0.95

Tested by 1

TestChain_AddDropIPRuleFunction · 0.64