lib

package
v0.0.0-...-8e6929d Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HippoAddressServiceName ...
	HippoAddressServiceName = "github.com/XieGuochao/HippoCoinRegister"

	// TTL ...
	// The TTL is 60 seconds
	TTL = 60

	// MaxQuery ...
	MaxQuery = 30

	// MaxCycle ...
	MaxCycle = 5

	// NumPerCycle ...
	NumPerCycle = 20

	// Threshold ...
	Threshold = 0.2
)

Variables

View Source
var Cache sync.Map

Cache ...

Functions

func GetOutboundIP

func GetOutboundIP() net.IP

GetOutboundIP ... Get preferred outbound ip of this machine

func RegisterHippoAddress

func RegisterHippoAddress(svc HippoAddressServiceInterface) error

RegisterHippoAddress ...

Types

type Addresses

type Addresses = []string

Addresses ...

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client ...

func CreateClient

func CreateClient(protocol, address string) (client *Client, err error)

CreateClient ...

func (*Client) Addresses

func (client *Client) Addresses(number int, reply *[]byte) error

Addresses ... Get up to 30 addresses.

func (*Client) AddressesRefresh

func (client *Client) AddressesRefresh(refresh RefreshStruct, reply *[]byte) error

AddressesRefresh ... Get up to 30 addresses.

func (*Client) Close

func (client *Client) Close()

Close ...

func (*Client) Ping

func (client *Client) Ping(request string, reply *string) error

Ping ...

func (*Client) Register

func (client *Client) Register(address string, reply *string) error

Register ...

type HippoAddressServiceInterface

type HippoAddressServiceInterface = interface {
	Ping(request string, reply *string) error
	Register(address string, reply *string) error
	Addresses(number int, reply *[]byte) error
	AddressesRefresh(refresh RefreshStruct, reply *[]byte) error
}

HippoAddressServiceInterface ...

type RefreshStruct

type RefreshStruct struct {
	Number  int
	Address string
}

RefreshStruct ...

type ServiceStruct

type ServiceStruct struct {
}

ServiceStruct ...

func (*ServiceStruct) Addresses

func (s *ServiceStruct) Addresses(number int, reply *[]byte) error

Addresses ...

func (*ServiceStruct) AddressesRefresh

func (s *ServiceStruct) AddressesRefresh(refresh RefreshStruct, reply *[]byte) error

AddressesRefresh ... Get the addresses and refresh expiration

func (*ServiceStruct) Ping

func (s *ServiceStruct) Ping(request string, reply *string) error

Ping ...

func (*ServiceStruct) Register

func (s *ServiceStruct) Register(address string, reply *string) error

Register ...

Jump to

Keyboard shortcuts

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