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

Method AddAcceptIPv4Rule

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

Source from the content-addressed store, hash-verified

55}
56
57func (this *Chain) AddAcceptIPv4Rule(ip []byte, userData []byte) (*Rule, error) {
58 return this.AddRule(&RuleOptions{
59 Exprs: []expr.Any{
60 &expr.Payload{
61 DestRegister: 1,
62 Base: expr.PayloadBaseNetworkHeader,
63 Offset: 12,
64 Len: 4,
65 },
66 &expr.Cmp{
67 Op: expr.CmpOpEq,
68 Register: 1,
69 Data: ip,
70 },
71 &expr.Verdict{
72 Kind: expr.VerdictAccept,
73 },
74 },
75 UserData: userData,
76 })
77}
78
79func (this *Chain) AddAcceptIPv6Rule(ip []byte, userData []byte) (*Rule, error) {
80 return this.AddRule(&RuleOptions{

Callers 1

Calls 1

AddRuleMethod · 0.95

Tested by 1