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

Method AddChain

internal/firewalls/nftables/table.go:51–70  ·  view source on GitHub ↗
(name string, chainPolicy *ChainPolicy)

Source from the content-addressed store, hash-verified

49}
50
51func (this *Table) AddChain(name string, chainPolicy *ChainPolicy) (*Chain, error) {
52 if len(name) > MaxChainNameLength {
53 return nil, errors.New("chain name too long (max " + types.String(MaxChainNameLength) + ")")
54 }
55
56 var rawChain = this.conn.Raw().AddChain(&nft.Chain{
57 Name: name,
58 Table: this.rawTable,
59 Hooknum: nft.ChainHookInput,
60 Priority: nft.ChainPriorityFilter,
61 Type: nft.ChainTypeFilter,
62 Policy: chainPolicy,
63 })
64
65 err := this.conn.Commit()
66 if err != nil {
67 return nil, err
68 }
69 return NewChain(this.conn, this.rawTable, rawChain), nil
70}
71
72func (this *Table) AddAcceptChain(name string) (*Chain, error) {
73 var policy = ChainPolicyAccept

Callers 3

AddAcceptChainMethod · 0.95
AddDropChainMethod · 0.95
TestTable_AddChainFunction · 0.80

Calls 4

NewChainFunction · 0.85
StringMethod · 0.45
RawMethod · 0.45
CommitMethod · 0.45

Tested by 1

TestTable_AddChainFunction · 0.64