Movatterモバイル変換


[0]ホーム

URL:


portmappertype

package
v1.92.3Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2025 License:BSD-3-ClauseImports:8Imported by:0

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package portmappertype defines the net/portmapper interface, which may or may not belinked into the binary.

Index

Constants

This section is empty.

Variables

View Source
var (ErrNoPortMappingServices =errors.New("no port mapping services were found")ErrGatewayRange          =errors.New("skipping portmap; gateway range likely lacks support")ErrGatewayIPv6           =errors.New("skipping portmap; no IPv6 support for portmapping")ErrPortMappingDisabled   =errors.New("port mapping is disabled"))
View Source
var HookNewPortMapperfeature.Hook[func(logflogger.Logf,bus *eventbus.Bus,netMon *netmon.Monitor,disableUPnPOrNil,onlyTCP443OrNil func()bool)Client]

HookNewPortMapper is a hook to install the portmapper creation function.It must be set by an init function when buildfeatures.HasPortmapper is true.

Functions

This section is empty.

Types

typeClient

type Client interface {// Probe returns a summary of which port mapping services are available on// the network.//// If a probe has run recently and there haven't been any network changes// since, the returned result might be server from the Client's cache,// without sending any network traffic.Probe(context.Context) (ProbeResult,error)// HaveMapping reports whether we have a current valid mapping.HaveMapping()bool// SetGatewayLookupFunc set the func that returns the machine's default// gateway IP, and the primary IP address for that gateway. It must be// called before the client is used. If not called,// interfaces.LikelyHomeRouterIP is used.SetGatewayLookupFunc(f func() (gw, myIPnetip.Addr, okbool))// NoteNetworkDown should be called when the network has transitioned to a down state.// It's too late to release port mappings at this point (the user might've just turned off// their wifi), but we can make sure we invalidate mappings for later when the network// comes back.NoteNetworkDown()// GetCachedMappingOrStartCreatingOne quickly returns with our current cached portmapping, if any.// If there's not one, it starts up a background goroutine to create one.// If the background goroutine ends up creating one, the onChange hook registered with the// NewClient constructor (if any) will fire.GetCachedMappingOrStartCreatingOne() (externalnetip.AddrPort, okbool)// SetLocalPort updates the local port number to which we want to port// map UDP trafficSetLocalPort(localPortuint16)Close()error}

Client is the interface implemented by a portmapper client.

typeMapping

type Mapping struct {Externalnetip.AddrPortTypestringGoodUntiltime.Time}

Mapping is an event recording the allocation of a port mapping.

typeProbeResult

type ProbeResult struct {PCPboolPMPboolUPnPbool}

ProbeResult is the result of a portmapper probe, sayingwhich port mapping protocols were discovered.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp