node

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxUserNo         = 1 << 10
	MsgNoPerUser             = 1 << 6
	MsgAverageSize           = 1 << 8
	DefaultMaxMessageSize    = DefaultMaxUserNo * MsgNoPerUser * MsgAverageSize
	DefaultWorkerTryTimeOut  = 10 * time.Second
	DefaultOutboundQueueSize = 1 << 6
	DefaultIMThreadNo        = MsgNoPerUser * DefaultMaxUserNo
	DefaultLowConn           = 1 << 5
	DefaultHighConn          = 1 << 10
	DefaultConnGrace         = time.Minute

	DHTPrefix        = "ninja"
	MainChain ChanID = 1
	TestChain ChanID = 2

	P2pChanDebug = "/Global/TEST" //TODO:: scheme

	P2pChanUserOnOffLine = "/Global/user/on_offline"
	P2pChanImmediateMsg  = "/Global/message/immediate"
	P2pChanChainAcc      = "/Global/chain/account"

	StreamSyncOnline    = "/Rendezvous/user/onlineSet"
	StreamSyncChainData = "/Rendezvous/chain/chainSync"
)

Variables

View Source
var (
	MainP2pBoots = []string{"/ip4/0.0.0.0/tcp/16669/p2p/12D3KooWH1vt62wMAzSBHaAhH273MV8hnNuwF7jrDWptGzGFzPNe",
		"/ip4/0.0.0.0/tcp/16669/p2p/12D3KooWH1vt62wMAzSBHaAhH273MV8hnNuwF7jrDWptGzGFzPNe"}

	TestP2pBoots = []string{
		"/ip4/34.96.141.169/tcp/16669/p2p/12D3KooWBhhVn4trfjwPGgDCjfdfnGF8rY5TLcUi8XVcvA6FvLLW",
		"/ip4/47.113.87.58/tcp/16669/p2p/12D3KooW9rMrpU6by3DdvSTuUoRR9YKrBAJM1hv78v2AfZGZPJGa",
	}
)

Functions

func InitConfig

func InitConfig(c *Config)

Types

type ChanID

type ChanID int

func (ChanID) String

func (c ChanID) String() string

type Config

type Config struct {
	HttpEnabled        bool          `json:"http.enabled"`
	SrvPort            int16         `json:"port"`
	WorkerStartTimeOut time.Duration `json:"worker.start.try"`
	ChainID            ChanID
	P2oLogOpen         bool               `json:"p2pLog"`
	PsConf             *pubSubConfig      `json:"pub_sub"`
	DHTConf            *dhtConfig         `json:"dht"`
	ConnMngConf        *connManagerConfig `json:"connManager"`
	SrvPost            bool               `json:"srv_post,omitempty"`
}

func DefaultConfig

func DefaultConfig(isMain bool, base string) *Config

func (Config) String

func (c Config) String() string

type NinjaNode

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

func Inst

func Inst() *NinjaNode

func (*NinjaNode) DebugPeerMsg

func (nt *NinjaNode) DebugPeerMsg(w *worker.TopicWorker)

func (*NinjaNode) DebugTopicMsg

func (nt *NinjaNode) DebugTopicMsg(topic, msg string) string

func (*NinjaNode) DebugTopicPeers

func (nt *NinjaNode) DebugTopicPeers(topic string) string

func (*NinjaNode) PeersOfTopic

func (nt *NinjaNode) PeersOfTopic(topic string) []peer.ID

func (*NinjaNode) RandomPeer

func (nt *NinjaNode) RandomPeer(protocID protocol.ID) (network.Stream, error)

func (*NinjaNode) ShutDown

func (nt *NinjaNode) ShutDown()

func (*NinjaNode) Start

func (nt *NinjaNode) Start() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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