1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-23 12:00:34 +08:00

chore: make lint happy

This commit is contained in:
源文雨
2024-07-11 18:26:17 +09:00
parent 2ad307df60
commit 9db2c9e0a6
2 changed files with 19 additions and 12 deletions

View File

@@ -4,8 +4,9 @@ linters-settings:
exclude-functions: exclude-functions:
- fmt:.* - fmt:.*
- io/ioutil:^Read.* - io/ioutil:^Read.*
- github.com/fumiama/WireGold/helper.(*Writer).(Write.*) - os:\(\*File\)\..*
- github.com/fumiama/WireGold/upper/services/tunnel.(*Tunnel).(Write|Read) - github.com/fumiama/WireGold/helper:\(\*Writer\)\.Write.*
- github.com/fumiama/WireGold/upper/services/tunnel:\(\*Tunnel\)\.(Write|Read)
goimports: goimports:
local-prefixes: github.com/fumiama/WireGold local-prefixes: github.com/fumiama/WireGold

View File

@@ -41,11 +41,13 @@ func TestTunnel(t *testing.T) {
MTU: 4096, MTU: 4096,
}) })
m.AddPeer(&link.PeerConfig{ m.AddPeer(&link.PeerConfig{
PeerIP: "192.168.1.3", PeerIP: "192.168.1.3",
EndPoint: "127.0.0.1:21247", EndPoint: "127.0.0.1:21247",
AllowedIPs: []string{"192.168.1.3/32"}, AllowedIPs: []string{"192.168.1.3/32"},
PubicKey: peerpk.Public(), PubicKey: peerpk.Public(),
MTU: 4096, MTU: 4096,
MTURandomRange: 1024,
UseZstd: true,
}) })
p := link.NewMe(&link.MyConfig{ p := link.NewMe(&link.MyConfig{
MyIPwithMask: "192.168.1.3/32", MyIPwithMask: "192.168.1.3/32",
@@ -56,11 +58,13 @@ func TestTunnel(t *testing.T) {
MTU: 4096, MTU: 4096,
}) })
p.AddPeer(&link.PeerConfig{ p.AddPeer(&link.PeerConfig{
PeerIP: "192.168.1.2", PeerIP: "192.168.1.2",
EndPoint: "127.0.0.1:21246", EndPoint: "127.0.0.1:21246",
AllowedIPs: []string{"192.168.1.2/32"}, AllowedIPs: []string{"192.168.1.2/32"},
PubicKey: selfpk.Public(), PubicKey: selfpk.Public(),
MTU: 4096, MTU: 4096,
MTURandomRange: 1024,
UseZstd: true,
}) })
tunnme, err := Create(&m, "192.168.1.3") tunnme, err := Create(&m, "192.168.1.3")
if err != nil { if err != nil {
@@ -102,6 +106,8 @@ func TestTunnel(t *testing.T) {
t.Log("read", n, "bytes") t.Log("read", n, "bytes")
if string(sendb) != string(buf) { if string(sendb) != string(buf) {
t.Fatal("error: recv 65535 bytes data") t.Fatal("error: recv 65535 bytes data")
t.Log("expect", hex.EncodeToString(sendb))
t.Log("got", hex.EncodeToString(buf))
} }
tunnme.Stop() tunnme.Stop()