|
|
@ -270,7 +270,7 @@ func IsNoMappingError(err error) bool {
|
|
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
var (
|
|
|
|
ErrNoPortMappingServices = errors.New("no port mapping services were found")
|
|
|
|
ErrNoPortMappingServices = errors.New("no port mapping services were found")
|
|
|
|
ErrGatewayNotFound = errors.New("failed to look up gateway address")
|
|
|
|
ErrGatewayRange = errors.New("skipping portmap; gateway range likely lacks support")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// GetCachedMappingOrStartCreatingOne quickly returns with our current cached portmapping, if any.
|
|
|
|
// GetCachedMappingOrStartCreatingOne quickly returns with our current cached portmapping, if any.
|
|
|
@ -331,7 +331,7 @@ func (c *Client) createMapping() {
|
|
|
|
func (c *Client) createOrGetMapping(ctx context.Context) (external netaddr.IPPort, err error) {
|
|
|
|
func (c *Client) createOrGetMapping(ctx context.Context) (external netaddr.IPPort, err error) {
|
|
|
|
gw, myIP, ok := c.gatewayAndSelfIP()
|
|
|
|
gw, myIP, ok := c.gatewayAndSelfIP()
|
|
|
|
if !ok {
|
|
|
|
if !ok {
|
|
|
|
return netaddr.IPPort{}, NoMappingError{ErrGatewayNotFound}
|
|
|
|
return netaddr.IPPort{}, NoMappingError{ErrGatewayRange}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
c.mu.Lock()
|
|
|
|
c.mu.Lock()
|
|
|
@ -540,7 +540,7 @@ type ProbeResult struct {
|
|
|
|
func (c *Client) Probe(ctx context.Context) (res ProbeResult, err error) {
|
|
|
|
func (c *Client) Probe(ctx context.Context) (res ProbeResult, err error) {
|
|
|
|
gw, myIP, ok := c.gatewayAndSelfIP()
|
|
|
|
gw, myIP, ok := c.gatewayAndSelfIP()
|
|
|
|
if !ok {
|
|
|
|
if !ok {
|
|
|
|
return res, ErrGatewayNotFound
|
|
|
|
return res, ErrGatewayRange
|
|
|
|
}
|
|
|
|
}
|
|
|
|
defer func() {
|
|
|
|
defer func() {
|
|
|
|
if err == nil {
|
|
|
|
if err == nil {
|
|
|
|