From c4ce0d0d3685d37c23bbe75646d38a177a3816e0 Mon Sep 17 00:00:00 2001 From: Kusakabe Si Date: Sun, 28 Nov 2021 11:39:40 +0000 Subject: [PATCH] update some patamater --- .vscode/launch.json | 2 +- Makefile | 4 ++-- example_config/super_mode/n1.yaml | 2 +- example_config/super_mode/n2.yaml | 2 +- example_config/super_mode/s1.yaml | 2 +- main_edge.go | 8 +++----- main_super.go | 4 +--- tap/tap_fd.go | 3 +++ tap/tap_linux.go | 9 ++++++--- tap/tap_vpp.go | 2 +- tap/tap_vpp_fake.go | 2 +- 11 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 5a6bdde..b8a1635 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,7 @@ "request": "launch", "mode": "auto", "program": "${workspaceFolder}", - "buildFlags": "-tags=vpp", + "buildFlags": "-tags 'novpp'", "env": {"CGO_CFLAGS":"-I/usr/include/memif"}, "args":["-config","example_config/super_mode/s1.yaml","-mode","super"/*,"-example"*/], } diff --git a/Makefile b/Makefile index 2a12a3a..6eef4d7 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ etherguard-go: $(wildcard *.go) $(wildcard */*.go) go mod download && \ go mod tidy && \ go mod vendor && \ - go build -v -tags novpp -o "$@" + go build -v -o "$@" vpp: @export GIT_CEILING_DIRECTORIES="$(realpath $(CURDIR)/..)" && \ @@ -37,7 +37,7 @@ etherguard-go-vpp: $(wildcard *.go) $(wildcard */*.go) go mod tidy && \ go mod vendor && \ patch -p0 -i govpp_remove_crcstring_check.patch && \ - go build -v -o "$@" + go build -v -tags vpp -o "$@" install: etherguard-go @install -v -d "$(DESTDIR)$(BINDIR)" && install -v -m 0755 "$<" "$(DESTDIR)$(BINDIR)/etherguard-go" diff --git a/example_config/super_mode/n1.yaml b/example_config/super_mode/n1.yaml index 4073104..b6773fc 100644 --- a/example_config/super_mode/n1.yaml +++ b/example_config/super_mode/n1.yaml @@ -26,7 +26,7 @@ dynamicroute: sendpinginterval: 16 peeralivetimeout: 70 dupchecktimeout: 40 - conntimeout: 30 + conntimeout: 20 connnexttry: 5 savenewpeers: true supernode: diff --git a/example_config/super_mode/n2.yaml b/example_config/super_mode/n2.yaml index ecdcd4b..2bb7e2d 100644 --- a/example_config/super_mode/n2.yaml +++ b/example_config/super_mode/n2.yaml @@ -26,7 +26,7 @@ dynamicroute: sendpinginterval: 16 peeralivetimeout: 70 dupchecktimeout: 40 - conntimeout: 30 + conntimeout: 20 connnexttry: 5 savenewpeers: true supernode: diff --git a/example_config/super_mode/s1.yaml b/example_config/super_mode/s1.yaml index e29fd47..7101b72 100644 --- a/example_config/super_mode/s1.yaml +++ b/example_config/super_mode/s1.yaml @@ -19,7 +19,7 @@ graphrecalculatesetting: staticmode: false jittertolerance: 5 jittertolerancemultiplier: 1.01 - nodereporttimeout: 20 + nodereporttimeout: 70 timeoutcheckinterval: 5 recalculatecooldown: 1 nexthoptable: diff --git a/main_edge.go b/main_edge.go index 29e6b24..04d5b7f 100644 --- a/main_edge.go +++ b/main_edge.go @@ -1,5 +1,3 @@ -// +build !windows - /* SPDX-License-Identifier: MIT * * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. @@ -57,10 +55,10 @@ func printExampleEdgeConf() { LogNTP: false, }, DynamicRoute: config.DynamicRouteInfo{ - SendPingInterval: 20, - PeerAliveTimeout: 30, + SendPingInterval: 16, + PeerAliveTimeout: 70, DupCheckTimeout: 40, - ConnTimeOut: 30, + ConnTimeOut: 20, ConnNextTry: 5, SaveNewPeers: true, SuperNode: config.SuperInfo{ diff --git a/main_super.go b/main_super.go index 51ce958..4b5383a 100644 --- a/main_super.go +++ b/main_super.go @@ -1,5 +1,3 @@ -// +build !windows - /* SPDX-License-Identifier: MIT * * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. @@ -91,7 +89,7 @@ func printExampleSuperConf() { StaticMode: false, JitterTolerance: 5, JitterToleranceMultiplier: 1.01, - NodeReportTimeout: 40, + NodeReportTimeout: 70, TimeoutCheckInterval: 5, RecalculateCoolDown: 5, }, diff --git a/tap/tap_fd.go b/tap/tap_fd.go index f663953..37c4ec0 100644 --- a/tap/tap_fd.go +++ b/tap/tap_fd.go @@ -1,3 +1,6 @@ +//go:build !windows +// +build !windows + package tap import ( diff --git a/tap/tap_linux.go b/tap/tap_linux.go index 7d6d14f..519508a 100644 --- a/tap/tap_linux.go +++ b/tap/tap_linux.go @@ -1,3 +1,6 @@ +//go:build !windows +// +build !windows + /* SPDX-License-Identifier: MIT * * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved. @@ -450,7 +453,7 @@ func (tap *NativeTap) Close() error { return err2 } -func CreateTAP(iconfig config.InterfaceConf,NodeID config.Vertex) (Device, error) { +func CreateTAP(iconfig config.InterfaceConf, NodeID config.Vertex) (Device, error) { nfd, err := unix.Open(cloneDevicePath, os.O_RDWR, 0) if err != nil { if os.IsNotExist(err) { @@ -490,10 +493,10 @@ func CreateTAP(iconfig config.InterfaceConf,NodeID config.Vertex) (Device, error return nil, err } - return CreateTAPFromFile(fd, iconfig,NodeID) + return CreateTAPFromFile(fd, iconfig, NodeID) } -func CreateTAPFromFile(file *os.File, iconfig config.InterfaceConf,NodeID config.Vertex) (Device, error) { +func CreateTAPFromFile(file *os.File, iconfig config.InterfaceConf, NodeID config.Vertex) (Device, error) { tap := &NativeTap{ tapFile: file, events: make(chan Event, 5), diff --git a/tap/tap_vpp.go b/tap/tap_vpp.go index 96392e4..cc7a7fd 100644 --- a/tap/tap_vpp.go +++ b/tap/tap_vpp.go @@ -1,4 +1,4 @@ -//+build !novpp +//+build vpp package tap diff --git a/tap/tap_vpp_fake.go b/tap/tap_vpp_fake.go index e99d035..6bc2079 100644 --- a/tap/tap_vpp_fake.go +++ b/tap/tap_vpp_fake.go @@ -1,4 +1,4 @@ -//+build novpp +//+build !vpp package tap