From 3e27b3c33c6c2f35ab7c20637e01b3d9c9c6befe Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 15 May 2020 02:58:22 +0000 Subject: [PATCH] wgengine/router: more comments. Signed-off-by: David Anderson --- wgengine/router/router_linux.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wgengine/router/router_linux.go b/wgengine/router/router_linux.go index ba53505da..1cd24890e 100644 --- a/wgengine/router/router_linux.go +++ b/wgengine/router/router_linux.go @@ -53,6 +53,9 @@ const ( // avoid allocating Tailscale IPs from it, to avoid conflicts. const chromeOSVMRange = "100.115.92.0/23" +// netfilterRunner abstracts helpers to run netfilter commands. It +// exists purely to swap out go-iptables for a fake implementation in +// tests. type netfilterRunner interface { Insert(table, chain string, pos int, args ...string) error Append(table, chain string, args ...string) error @@ -64,6 +67,9 @@ type netfilterRunner interface { DeleteChain(table, chain string) error } +// commandRunner abstracts helpers to run OS commands. It exists +// purely to swap out osCommandRunner (below) with a fake runner in +// tests. type commandRunner interface { run(...string) error output(...string) ([]byte, error)