|
|
@ -163,11 +163,7 @@ func newMagicStack(t testing.TB, logf logger.Logf, l nettype.PacketListener, der
|
|
|
|
tsTun.SetFilter(filter.NewAllowAllForTest(logf))
|
|
|
|
tsTun.SetFilter(filter.NewAllowAllForTest(logf))
|
|
|
|
|
|
|
|
|
|
|
|
dev := device.NewDevice(tsTun, &device.DeviceOptions{
|
|
|
|
dev := device.NewDevice(tsTun, &device.DeviceOptions{
|
|
|
|
Logger: &device.Logger{
|
|
|
|
Logger: wireguardGoLogger(logf),
|
|
|
|
Debug: logger.StdLogger(logf),
|
|
|
|
|
|
|
|
Info: logger.StdLogger(logf),
|
|
|
|
|
|
|
|
Error: logger.StdLogger(logf),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
CreateEndpoint: conn.CreateEndpoint,
|
|
|
|
CreateEndpoint: conn.CreateEndpoint,
|
|
|
|
CreateBind: conn.CreateBind,
|
|
|
|
CreateBind: conn.CreateBind,
|
|
|
|
SkipBindUpdate: true,
|
|
|
|
SkipBindUpdate: true,
|
|
|
@ -527,11 +523,7 @@ func TestDeviceStartStop(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
tun := tuntest.NewChannelTUN()
|
|
|
|
tun := tuntest.NewChannelTUN()
|
|
|
|
dev := device.NewDevice(tun.TUN(), &device.DeviceOptions{
|
|
|
|
dev := device.NewDevice(tun.TUN(), &device.DeviceOptions{
|
|
|
|
Logger: &device.Logger{
|
|
|
|
Logger: wireguardGoLogger(t.Logf),
|
|
|
|
Debug: logger.StdLogger(t.Logf),
|
|
|
|
|
|
|
|
Info: logger.StdLogger(t.Logf),
|
|
|
|
|
|
|
|
Error: logger.StdLogger(t.Logf),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
CreateEndpoint: conn.CreateEndpoint,
|
|
|
|
CreateEndpoint: conn.CreateEndpoint,
|
|
|
|
CreateBind: conn.CreateBind,
|
|
|
|
CreateBind: conn.CreateBind,
|
|
|
|
SkipBindUpdate: true,
|
|
|
|
SkipBindUpdate: true,
|
|
|
@ -609,11 +601,7 @@ func TestConnClosing(t *testing.T) {
|
|
|
|
tsTun.SetFilter(filter.NewAllowAllForTest(t.Logf))
|
|
|
|
tsTun.SetFilter(filter.NewAllowAllForTest(t.Logf))
|
|
|
|
|
|
|
|
|
|
|
|
dev := device.NewDevice(tsTun, &device.DeviceOptions{
|
|
|
|
dev := device.NewDevice(tsTun, &device.DeviceOptions{
|
|
|
|
Logger: &device.Logger{
|
|
|
|
Logger: wireguardGoLogger(t.Logf),
|
|
|
|
Debug: logger.StdLogger(t.Logf),
|
|
|
|
|
|
|
|
Info: logger.StdLogger(t.Logf),
|
|
|
|
|
|
|
|
Error: logger.StdLogger(t.Logf),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
CreateEndpoint: conn.CreateEndpoint,
|
|
|
|
CreateEndpoint: conn.CreateEndpoint,
|
|
|
|
CreateBind: conn.CreateBind,
|
|
|
|
CreateBind: conn.CreateBind,
|
|
|
|
SkipBindUpdate: true,
|
|
|
|
SkipBindUpdate: true,
|
|
|
@ -1554,3 +1542,19 @@ func BenchmarkReceiveFrom_Native(b *testing.B) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func wireguardGoLogger(logf logger.Logf) *device.Logger {
|
|
|
|
|
|
|
|
// wireguard-go logs as it starts and stops routines.
|
|
|
|
|
|
|
|
// Silence those; there are a lot of them, and they're just noise.
|
|
|
|
|
|
|
|
allowLogf := func(s string) bool {
|
|
|
|
|
|
|
|
return !strings.Contains(s, "Routine:")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
filtered := logger.Filtered(logf, allowLogf)
|
|
|
|
|
|
|
|
stdLogger := logger.StdLogger(filtered)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return &device.Logger{
|
|
|
|
|
|
|
|
Debug: stdLogger,
|
|
|
|
|
|
|
|
Info: stdLogger,
|
|
|
|
|
|
|
|
Error: stdLogger,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|