Merge pull request #21184 from commodo/numpy
[feed/packages.git] / net / tailscale / patches / 010-fake_iptables.patch
1 --- a/go.mod
2 +++ b/go.mod
3 @@ -2,6 +2,8 @@ module tailscale.com
4
5 go 1.20
6
7 +replace github.com/coreos/go-iptables => ./patched/go-iptables
8 +
9 require (
10 filippo.io/mkcert v1.4.4
11 github.com/Microsoft/go-winio v0.6.1
12 --- a/patched/go-iptables/iptables/iptables.go
13 +++ b/patched/go-iptables/iptables/iptables.go
14 @@ -149,12 +149,39 @@ func New(opts ...option) (*IPTables, err
15 return ipt, nil
16 }
17
18 +func NewFake(opts ...option) (*IPTables, error) {
19 +
20 + ipt := &IPTables{
21 + path: "/bin/false",
22 + proto: ProtocolIPv4,
23 + hasCheck: false,
24 + hasWait: false,
25 + waitSupportSecond: false,
26 + hasRandomFully: false,
27 + v1: 0,
28 + v2: 0,
29 + v3: 0,
30 + mode: "legacy",
31 + timeout: 0,
32 + }
33 +
34 + for _, opt := range opts {
35 + opt(ipt)
36 + }
37 +
38 + return ipt, nil
39 +}
40 +
41 // New creates a new IPTables for the given proto.
42 // The proto will determine which command is used, either "iptables" or "ip6tables".
43 func NewWithProtocol(proto Protocol) (*IPTables, error) {
44 return New(IPFamily(proto), Timeout(0))
45 }
46
47 +func NewFakeWithProtocol(proto Protocol) (*IPTables, error) {
48 + return NewFake(IPFamily(proto), Timeout(0))
49 +}
50 +
51 // Proto returns the protocol used by this IPTables.
52 func (ipt *IPTables) Proto() Protocol {
53 return ipt.proto