ipresolver

package
v0.0.0-...-05217b6 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2018 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultEchoIpV4Server = "https://ipv4.ip.openspa.org"
View Source
const DefaultEchoIpV6Server = "https://ipv6.ip.openspa.org"

Variables

This section is empty.

Functions

func IsBehindNAT

func IsBehindNAT(outbound net.IP, public net.IP) (bool, error)

If the outbound IP is equal to the public IP then we are not behind a NAT otherwise we most probably are.

Types

type EchoIPPublicResolver

type EchoIPPublicResolver struct {
}

Echo-IP public resolver: https://github.com/greenstatic/echo-ip

func (EchoIPPublicResolver) GetPublicIP

func (_ EchoIPPublicResolver) GetPublicIP(resolverUrl string) (ip net.IP, proxyIP net.IP, err error)

Returns the client's public IP with which they sent a HTTP POST request to a Echo-IP service. We send a HTTP POST request in case GET requests are cached. The resolverUrl string expects the URL of the Echo-IP resolver, this can be a http/https URL.

type OutboundDummySocketResolver

type OutboundDummySocketResolver struct {
}

func (*OutboundDummySocketResolver) GetIPv4OutboundIP

func (outbound *OutboundDummySocketResolver) GetIPv4OutboundIP() (net.IP, error)

func (*OutboundDummySocketResolver) GetIPv6OutboundIP

func (outbound *OutboundDummySocketResolver) GetIPv6OutboundIP() (net.IP, error)

type OutboundResolver

type OutboundResolver interface {
	GetIPv4OutboundIP() (net.IP, error)
	GetIPv6OutboundIP() (net.IP, error)
}

type PublicResolver

type PublicResolver interface {
	GetPublicIP(string) (net.IP, net.IP, error)
}

Resolves the client's public IP by returning the public IP used by the client and the last proxy IP (in case any are in use).

type ResolveResponse

type ResolveResponse struct {
	OutboundIPv4 net.IP
	OutboundIPv6 net.IP

	PublicIPv4 net.IP
	ProxyIPv4  net.IP
	NatIPv4    bool

	PublicIPv6 net.IP
	ProxyIPv6  net.IP
	NatIPv6    bool

	NoIPv4Outbound bool
	NoIPv4Public   bool

	NoIPv6Outbound bool
	NoIPv6Public   bool
}

func Resolve

func Resolve(echoIPServerIPv4, echoIPServerIPv6 string) (ResolveResponse, error)

Returns various network related IP addresses.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL