Refactor handling of local traffic detection.
This commit is contained in:
@@ -57,6 +57,7 @@ type Rule map[string]string
|
||||
type FakeIPTables struct {
|
||||
hasRandomFully bool
|
||||
Lines []byte
|
||||
ipv6 bool
|
||||
}
|
||||
|
||||
// NewFake returns a no-op iptables.Interface
|
||||
@@ -64,6 +65,11 @@ func NewFake() *FakeIPTables {
|
||||
return &FakeIPTables{}
|
||||
}
|
||||
|
||||
// NewIpv6Fake returns a no-op iptables.Interface with IsIPv6() == true
|
||||
func NewIpv6Fake() *FakeIPTables {
|
||||
return &FakeIPTables{ipv6: true}
|
||||
}
|
||||
|
||||
// SetHasRandomFully is part of iptables.Interface
|
||||
func (f *FakeIPTables) SetHasRandomFully(can bool) *FakeIPTables {
|
||||
f.hasRandomFully = can
|
||||
@@ -96,8 +102,8 @@ func (*FakeIPTables) DeleteRule(table iptables.Table, chain iptables.Chain, args
|
||||
}
|
||||
|
||||
// IsIpv6 is part of iptables.Interface
|
||||
func (*FakeIPTables) IsIpv6() bool {
|
||||
return false
|
||||
func (f *FakeIPTables) IsIpv6() bool {
|
||||
return f.ipv6
|
||||
}
|
||||
|
||||
// Save is part of iptables.Interface
|
||||
|
Reference in New Issue
Block a user