seed

package module
v0.0.0-...-11fa631 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// プロトコルバージョン
	ProtocolVersion = "A1"

	// Node ID.
	NidStrNone    = ""
	NidStrThis    = "."
	NidStrSeed    = "seed"
	NidStrNext    = "next"
	NidTypeNone   = 0
	NidTypeNormal = 1
	NidTypeThis   = 2
	NidTypeSeed   = 3
	NidTypeNext   = 4

	// Packet mode.
	ModeNone      = 0x0000
	ModeReply     = 0x0001
	ModeExplicit  = 0x0002
	ModeOneWay    = 0x0004
	ModeRelaySeed = 0x0008
	ModeNoRetry   = 0x0010

	ChannelNone          = 0
	ChannelSeed          = 1
	ChannelWebrtcConnect = 2

	// Commonly packet method.
	MethodError   = 0xffff
	MethodFailure = 0xfffe
	MethodSuccess = 0xfffd

	MethodSeedAuth          = 1
	MethodSeedHint          = 2
	MethodSeedPing          = 3
	MethodSeedRequireRandom = 4

	MethodWebrtcConnectOffer = 1

	// Offer type of WebRTC connect.
	OfferTypeFirst = 0

	// Hint
	HintOnlyone  = 0x0001
	HintAssigned = 0x0002

	// Key of routineLocal
	GroupMutex = 1
	LinkMutex  = 2
)

Variables

This section is empty.

Functions

func SetLogger

func SetLogger(l *Logger)

Types

type Config

type Config struct {
	Revision     float64                `json:"revision"`
	PingInterval int64                  `json:"pingInterval"`
	Timeout      int64                  `json:"timeout"`
	Node         map[string]interface{} `json:"node"`
}

func (*Config) CastConfig

func (c *Config) CastConfig() *Config

type Group

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

type GroupBinder

type GroupBinder interface {
	Bind(string) (*Group, error)
}
type Link struct {
	// contains filtered or unexported fields
}

type Logger

type Logger struct {
	E *log.Logger
	W *log.Logger
	I *log.Logger
	D *log.Logger
}

Logger is interface of used to output log for seed module.

type Pool

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

func NewPool

func NewPool(size int) *Pool

func (*Pool) Schedule

func (p *Pool) Schedule(task func()) error

type Seed

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

func NewSeed

func NewSeed(binder GroupBinder) *Seed

func (*Seed) CreateGroup

func (seed *Seed) CreateGroup(groupName string, config *Config) *Group

func (*Seed) DestroyGroup

func (seed *Seed) DestroyGroup(group *Group)

func (*Seed) GetGroup

func (seed *Seed) GetGroup(name string) (group *Group, ok bool)

func (*Seed) Start

func (seed *Seed) Start(host string, port int) error

Jump to

Keyboard shortcuts

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