mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-27 04:46:40 +00:00
net/netmon: remove usage of direct callbacks from netmon (#17292)
The callback itself is not removed as it is used in other repos, making it simpler for those to slowly transition to the eventbus. Updates #15160 Signed-off-by: Claus Lensbøl <claus@tailscale.com>
This commit is contained in:
@@ -223,6 +223,7 @@ func TestDirectProxyManual(t *testing.T) {
|
||||
|
||||
dialer := &tsdial.Dialer{}
|
||||
dialer.SetNetMon(netmon.NewStatic())
|
||||
dialer.SetBus(bus)
|
||||
|
||||
opts := Options{
|
||||
Persist: persist.Persist{},
|
||||
@@ -300,6 +301,7 @@ func testHTTPS(t *testing.T, withProxy bool) {
|
||||
|
||||
dialer := &tsdial.Dialer{}
|
||||
dialer.SetNetMon(netmon.NewStatic())
|
||||
dialer.SetBus(bus)
|
||||
dialer.SetSystemDialerForTest(func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
host, _, err := net.SplitHostPort(addr)
|
||||
if err != nil {
|
||||
|
||||
@@ -27,13 +27,15 @@ func TestNewDirect(t *testing.T) {
|
||||
bus := eventbustest.NewBus(t)
|
||||
|
||||
k := key.NewMachine()
|
||||
dialer := tsdial.NewDialer(netmon.NewStatic())
|
||||
dialer.SetBus(bus)
|
||||
opts := Options{
|
||||
ServerURL: "https://example.com",
|
||||
Hostinfo: hi,
|
||||
GetMachinePrivateKey: func() (key.MachinePrivate, error) {
|
||||
return k, nil
|
||||
},
|
||||
Dialer: tsdial.NewDialer(netmon.NewStatic()),
|
||||
Dialer: dialer,
|
||||
Bus: bus,
|
||||
}
|
||||
c, err := NewDirect(opts)
|
||||
@@ -105,13 +107,15 @@ func TestTsmpPing(t *testing.T) {
|
||||
bus := eventbustest.NewBus(t)
|
||||
|
||||
k := key.NewMachine()
|
||||
dialer := tsdial.NewDialer(netmon.NewStatic())
|
||||
dialer.SetBus(bus)
|
||||
opts := Options{
|
||||
ServerURL: "https://example.com",
|
||||
Hostinfo: hi,
|
||||
GetMachinePrivateKey: func() (key.MachinePrivate, error) {
|
||||
return k, nil
|
||||
},
|
||||
Dialer: tsdial.NewDialer(netmon.NewStatic()),
|
||||
Dialer: dialer,
|
||||
Bus: bus,
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"tailscale.com/tstest/nettest"
|
||||
"tailscale.com/types/key"
|
||||
"tailscale.com/types/logger"
|
||||
"tailscale.com/util/eventbus/eventbustest"
|
||||
)
|
||||
|
||||
// maxAllowedNoiseVersion is the highest we expect the Tailscale
|
||||
@@ -175,6 +176,7 @@ func (tt noiseClientTest) run(t *testing.T) {
|
||||
serverPrivate := key.NewMachine()
|
||||
clientPrivate := key.NewMachine()
|
||||
chalPrivate := key.NewChallenge()
|
||||
bus := eventbustest.NewBus(t)
|
||||
|
||||
const msg = "Hello, client"
|
||||
h2 := &http2.Server{}
|
||||
@@ -194,6 +196,7 @@ func (tt noiseClientTest) run(t *testing.T) {
|
||||
defer hs.Close()
|
||||
|
||||
dialer := tsdial.NewDialer(netmon.NewStatic())
|
||||
dialer.SetBus(bus)
|
||||
if nettest.PreferMemNetwork() {
|
||||
dialer.SetSystemDialerForTest(nw.Dial)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user