dynamicip

package
v1.8.13 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: BSD-3-Clause Imports: 11 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (

	// Note: All of the names below must be lowercase
	// because we lowercase the user's input in NewResolver.
	// TODO remove either ifConfig or ifConfigCo.
	// They do the same thing.
	OpenDNSName    = "opendns"
	IFConfigName   = "ifconfig"
	IFConfigCoName = "ifconfigco"
	IFConfigMeName = "ifconfigme"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Resolver

type Resolver interface {
	// Resolve and return our public IP.
	Resolve() (net.IP, error)
}

Resolver resolves our public IP

func NewResolver

func NewResolver(resolverName string) (Resolver, error)

Returns a new Resolver that uses the given service to resolve our public IP. [resolverName] must be one of: OpenDNSName, IFConfigName, IFConfigCoName, IFConfigMeName. If [resolverService] isn't one of the above, returns an error

type Updater

type Updater interface {
	// Start periodically resolving and updating our public IP.
	// Doesn't return until after Stop() is called.
	// Should be called in a goroutine.
	Dispatch(log logging.Logger)
	// Stop resolving and updating our public IP.
	Stop()
}

Updater periodically updates this node's public IP. Dispatch() and Stop() should only be called once.

func NewNoUpdater

func NewNoUpdater() Updater

func NewUpdater

func NewUpdater(
	dynamicIP ips.DynamicIPPort,
	resolver Resolver,
	updateFreq time.Duration,
) Updater

Returns a new Updater that updates [dynamicIP] every [updateFreq]. Uses [resolver] to find out what our public IP is.

Jump to

Keyboard shortcuts

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