network

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package network is for creating internetworks

Index

Constants

This section is empty.

Variables

View Source
var (
	// NetworkChannel is the name of the tunnel channel for passing network messages
	NetworkChannel = "network"
	// ControlChannel is the name of the tunnel channel for passing control message
	ControlChannel = "control"
	// DefaultLink is default network link
	DefaultLink = "network"
)
View Source
var (
	// DefaultName is default network name
	DefaultName = "go.micro"
	// DefaultAddress is default network address
	DefaultAddress = ":0"
	// ResolveTime defines time interval to periodically resolve network nodes
	ResolveTime = 1 * time.Minute
	// AnnounceTime defines time interval to periodically announce node neighbours
	AnnounceTime = 30 * time.Second
)

Functions

This section is empty.

Types

type Network

type Network interface {
	// Name of the network
	Name() string
	// Address returns network bind address
	Address() string
	// Connect starts the resolver and tunnel server
	Connect() error
	// Close stops the tunnel and resolving
	Close() error
	// Client is micro client
	Client() client.Client
	// Server is micro server
	Server() server.Server
}

Network is micro network

func NewNetwork

func NewNetwork(opts ...Option) Network

NewNetwork returns a new network interface

type Option

type Option func(*Options)

func Address

func Address(a string) Option

Address sets the network address

func Id

func Id(id string) Option

Id sets the id of the network node

func Name

func Name(n string) Option

Name sets the network name

func Nodes

func Nodes(n ...string) Option

Nodes is a list of seed nodes used along with resolved node

func Proxy

func Proxy(p proxy.Proxy) Option

Proxy sets the network proxy

func Resolver

func Resolver(r resolver.Resolver) Option

Resolver is the network resolver

func Router

func Router(r router.Router) Option

Router sets the network router

func Tunnel

func Tunnel(t tunnel.Tunnel) Option

Tunnel sets the network tunnel

type Options

type Options struct {
	// Id of the node
	Id string
	// Name of the network
	Name string
	// Address to bind to
	Address string
	// Nodes is a list of seed nodes
	Nodes []string
	// Tunnel is network tunnel
	Tunnel tunnel.Tunnel
	// Router is network router
	Router router.Router
	// Proxy is network proxy
	Proxy proxy.Proxy
	// Resolver is network resolver
	Resolver resolver.Resolver
}

Options configure network

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns network default options

Directories

Path Synopsis
Package link provides a measured transport.Socket link Package link provides a measured link on top of a transport.Socket
Package link provides a measured transport.Socket link Package link provides a measured link on top of a transport.Socket
Package resolver resolves network names to addresses
Package resolver resolves network names to addresses
dns
Package dns resolves names to dns srv records
Package dns resolves names to dns srv records
http
Package http resolves names to network addresses using a http request
Package http resolves names to network addresses using a http request
registry
Package registry resolves names using the go-micro registry
Package registry resolves names using the go-micro registry
static
Package static is a static resolver
Package static is a static resolver

Jump to

Keyboard shortcuts

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