Skip to content

Commit 4386a21

Browse files
committed
Merge branch 'main' into ssh-rewrite
2 parents 5882daf + f530123 commit 4386a21

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2399
-974
lines changed

client/cmd/login.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"os"
7+
"os/exec"
78
"os/user"
89
"runtime"
910
"strings"
@@ -356,13 +357,21 @@ func openURL(cmd *cobra.Command, verificationURIComplete, userCode string, noBro
356357
cmd.Println("")
357358

358359
if !noBrowser {
359-
if err := open.Run(verificationURIComplete); err != nil {
360+
if err := openBrowser(verificationURIComplete); err != nil {
360361
cmd.Println("\nAlternatively, you may want to use a setup key, see:\n\n" +
361362
"https://docs.netbird.io/how-to/register-machines-using-setup-keys")
362363
}
363364
}
364365
}
365366

367+
// openBrowser opens the URL in a browser, respecting the BROWSER environment variable.
368+
func openBrowser(url string) error {
369+
if browser := os.Getenv("BROWSER"); browser != "" {
370+
return exec.Command(browser, url).Start()
371+
}
372+
return open.Run(url)
373+
}
374+
366375
// isUnixRunningDesktop checks if a Linux OS is running desktop environment
367376
func isUnixRunningDesktop() bool {
368377
if runtime.GOOS != "linux" && runtime.GOOS != "freebsd" {

client/firewall/iptables/acl_linux.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ func transformIPsetName(ipsetName string, sPort, dPort *firewall.Port, action fi
400400
return ""
401401
}
402402

403-
// Include action in the ipset name to prevent squashing rules with different actions
404403
actionSuffix := ""
405404
if action == firewall.ActionDrop {
406405
actionSuffix = "-drop"

client/iface/device.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ type WGTunDevice interface {
2323
FilteredDevice() *device.FilteredDevice
2424
Device() *wgdevice.Device
2525
GetNet() *netstack.Net
26+
GetICEBind() device.EndpointManager
2627
}

client/iface/device/device_android.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ func (t *WGTunDevice) GetNet() *netstack.Net {
150150
return nil
151151
}
152152

153+
// GetICEBind returns the ICEBind instance
154+
func (t *WGTunDevice) GetICEBind() EndpointManager {
155+
return t.iceBind
156+
}
157+
153158
func routesToString(routes []string) string {
154159
return strings.Join(routes, ";")
155160
}

client/iface/device/device_darwin.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,8 @@ func (t *TunDevice) assignAddr() error {
154154
func (t *TunDevice) GetNet() *netstack.Net {
155155
return nil
156156
}
157+
158+
// GetICEBind returns the ICEBind instance
159+
func (t *TunDevice) GetICEBind() EndpointManager {
160+
return t.iceBind
161+
}

client/iface/device/device_ios.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,8 @@ func (t *TunDevice) FilteredDevice() *FilteredDevice {
144144
func (t *TunDevice) GetNet() *netstack.Net {
145145
return nil
146146
}
147+
148+
// GetICEBind returns the ICEBind instance
149+
func (t *TunDevice) GetICEBind() EndpointManager {
150+
return t.iceBind
151+
}

client/iface/device/device_kernel_unix.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,8 @@ func (t *TunKernelDevice) assignAddr() error {
179179
func (t *TunKernelDevice) GetNet() *netstack.Net {
180180
return nil
181181
}
182+
183+
// GetICEBind returns nil for kernel mode devices
184+
func (t *TunKernelDevice) GetICEBind() EndpointManager {
185+
return nil
186+
}

client/iface/device/device_netstack.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type Bind interface {
2121
conn.Bind
2222
GetICEMux() (*udpmux.UniversalUDPMuxDefault, error)
2323
ActivityRecorder() *bind.ActivityRecorder
24+
EndpointManager
2425
}
2526

2627
type TunNetstackDevice struct {
@@ -155,3 +156,8 @@ func (t *TunNetstackDevice) Device() *device.Device {
155156
func (t *TunNetstackDevice) GetNet() *netstack.Net {
156157
return t.net
157158
}
159+
160+
// GetICEBind returns the bind instance
161+
func (t *TunNetstackDevice) GetICEBind() EndpointManager {
162+
return t.bind
163+
}

client/iface/device/device_usp_unix.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,8 @@ func (t *USPDevice) assignAddr() error {
146146
func (t *USPDevice) GetNet() *netstack.Net {
147147
return nil
148148
}
149+
150+
// GetICEBind returns the ICEBind instance
151+
func (t *USPDevice) GetICEBind() EndpointManager {
152+
return t.iceBind
153+
}

client/iface/device/device_windows.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,8 @@ func (t *TunDevice) assignAddr() error {
185185
func (t *TunDevice) GetNet() *netstack.Net {
186186
return nil
187187
}
188+
189+
// GetICEBind returns the ICEBind instance
190+
func (t *TunDevice) GetICEBind() EndpointManager {
191+
return t.iceBind
192+
}

0 commit comments

Comments
 (0)