resolver

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package resolver provides interface (and default implementation) to retrieve public insolar address.

Currently there are two default implementation of resolvers:

  • Using STUN server
  • No-op resolver which returns socket listen address

Usage:

var conn net.PacketConn

// get connection anywhere

r := resolver.NewStunResolver("")  // Using default stun server
publicAddr, _ := r.Resolve(conn)

fmt.Println(publicAddr)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PublicAddressResolver

type PublicAddressResolver interface {

	// Returns public insolar address from given connection.
	Resolve(conn net.PacketConn) (string, error)
}

PublicAddressResolver is insolar address resolver interface.

func NewExactResolver

func NewExactResolver() PublicAddressResolver

NewExactResolver returns new no-op resolver.

func NewStunResolver

func NewStunResolver(stunAddress string) PublicAddressResolver

NewStunResolver returns new STUN insolar address resolver.

Jump to

Keyboard shortcuts

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