mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
wgengine/magicsock: remove DefaultPort const
Assume it'll stay at 0 forever, so hard-code it and delete code conditional on it being non-0. Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
@@ -365,10 +365,6 @@ type activeDerp struct {
|
||||
createTime time.Time
|
||||
}
|
||||
|
||||
// DefaultPort is the default port to listen on.
|
||||
// The current default (zero) means to auto-select a random free port.
|
||||
const DefaultPort = 0
|
||||
|
||||
// Options contains options for Listen.
|
||||
type Options struct {
|
||||
// Logf optionally provides a log function to use.
|
||||
@@ -2617,17 +2613,7 @@ func (c *Conn) bind1(ruc **RebindingUDPConn, which string) error {
|
||||
host = "::1"
|
||||
}
|
||||
}
|
||||
var pc net.PacketConn
|
||||
var err error
|
||||
if c.port == 0 && DefaultPort != 0 {
|
||||
pc, err = c.listenPacket(which, host, DefaultPort)
|
||||
if err != nil {
|
||||
c.logf("magicsock: bind: default port %s/%v unavailable; picking random", which, DefaultPort)
|
||||
}
|
||||
}
|
||||
if pc == nil {
|
||||
pc, err = c.listenPacket(which, host, c.port)
|
||||
}
|
||||
pc, err := c.listenPacket(which, host, c.port)
|
||||
if err != nil {
|
||||
c.logf("magicsock: bind(%s/%v): %v", which, c.port, err)
|
||||
return fmt.Errorf("magicsock: bind: %s/%d: %v", which, c.port, err)
|
||||
|
Reference in New Issue
Block a user