From 7b295f3d2163f6327f6cf531b9996903ad9fa025 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 22 Jul 2021 13:22:58 -0700 Subject: [PATCH] net/portmapper: disable UPnP on iOS for now Updates #2495 Signed-off-by: Brad Fitzpatrick --- net/portmapper/disabled_stubs.go | 29 +++++++++++++++++++++++++++++ net/portmapper/upnp.go | 3 +++ 2 files changed, 32 insertions(+) create mode 100644 net/portmapper/disabled_stubs.go diff --git a/net/portmapper/disabled_stubs.go b/net/portmapper/disabled_stubs.go new file mode 100644 index 000000000..fb1572e78 --- /dev/null +++ b/net/portmapper/disabled_stubs.go @@ -0,0 +1,29 @@ +// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build ios +// (https://github.com/tailscale/tailscale/issues/2495) + +package portmapper + +import ( + "context" + + "inet.af/netaddr" +) + +type upnpClient interface{} + +func getUPnPClient(ctx context.Context, gw netaddr.IP) (upnpClient, error) { + return nil, nil +} + +func (c *Client) getUPnPPortMapping( + ctx context.Context, + gw netaddr.IP, + internal netaddr.IPPort, + prevPort uint16, +) (external netaddr.IPPort, ok bool) { + return netaddr.IPPort{}, false +} diff --git a/net/portmapper/upnp.go b/net/portmapper/upnp.go index e8ac9a8b3..5ec91353e 100644 --- a/net/portmapper/upnp.go +++ b/net/portmapper/upnp.go @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build !ios +// (https://github.com/tailscale/tailscale/issues/2495) + package portmapper import (