seed

package
v0.0.0-...-541135e Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Overview

* Copyright 2019-2021 Yuji Ito <llamerada.jp@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2019-2021 Yuji Ito <llamerada.jp@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2019-2021 Yuji Ito <llamerada.jp@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2019-2021 Yuji Ito <llamerada.jp@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const (
	// version
	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
	ChannelMain         = 1
	ChannelSeedAccessor = 2
	ChannelNodeAccessor = 3

	// 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

This section is empty.

Types

type Config

type Config struct {
	Revision     float64     `json:"revision,omitempty"`
	PingInterval int64       `json:"pingInterval"`
	Timeout      int64       `json:"timeout"`
	Node         *ConfigNode `json:"node,omitempty"`
}

type ConfigCoordSystem2D

type ConfigCoordSystem2D struct {
	Type *string `json:"type,omitempty"`
	// for sphere
	Radius *float64 `json:"radius,omitempty"`
	// for plane
	XMin *float64 `json:"xMin,omitempty"`
	XMax *float64 `json:"xMax,omitempty"`
	YMin *float64 `json:"yMin,omitempty"`
	YMax *float64 `json:"yMax,omitempty"`
}

type ConfigIceServer

type ConfigIceServer struct {
	Urls       []string `json:"urls,omitempty"`
	Username   *string  `json:"username,omitempty"`
	Credential *string  `json:"credential,omitempty"`
}

type ConfigModule

type ConfigModule struct {
	Type    string `json:"type"`
	Channel uint32 `json:"channel"`

	RetryMax         *uint32 `json:"retryMax,omitempty"`         // for map
	RetryIntervalMin *uint32 `json:"retryIntervalMin,omitempty"` // for map
	RetryIntervalMax *uint32 `json:"retryIntervalMax,omitempty"` // for map

	CacheTime *uint32 `json:"cacheTime,omitempty"` // for pubsub_2d
}

type ConfigNode

type ConfigNode struct {
	Revision      float64                 `json:"revision"`
	NodeAccessor  *ConfigNodeAccessor     `json:"nodeAccessor,omitempty"`
	CoordSystem2d *ConfigCoordSystem2D    `json:"coordSystem2D,omitempty"`
	IceServers    []ConfigIceServer       `json:"iceServers,omitempty"`
	Routing       *ConfigRouting          `json:"routing,omitempty"`
	Modules       map[string]ConfigModule `json:"modules,omitempty"`
}

type ConfigNodeAccessor

type ConfigNodeAccessor struct {
	BufferInterval *uint32 `json:"bufferInterval,omitempty"`
	HopCountMax    *uint32 `json:"hopCountMax,omitempty"`
	PacketSize     *uint32 `json:"packetSize,omitempty"`
}

type ConfigRouting

type ConfigRouting struct {
	ForceUpdateCount         *uint32  `json:"forceUpdateCount,omitempty"`
	SeedConnectInterval      *uint32  `json:"seedConnectInterval,omitempty"`
	SeedConnectRate          *uint32  `json:"seedConnectRate,omitempty"`
	SeedDisconnectThreathold *uint32  `json:"seedDisconnectThreathold,omitempty"`
	SeedInfoKeepThreathold   *uint32  `json:"seedInfoKeepThreathold,omitempty"`
	SeedInfoNidsCount        *uint32  `json:"seedInfoNidsCount,omitempty"`
	SeedNextPosition         *float64 `json:"seedNextPosition,omitempty"`
	UpdatePeriod             *uint32  `json:"updatePeriod,omitempty"`
}

type Node

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

type Seed

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

func NewSeed

func NewSeed(config *Config) (*Seed, error)

func (*Seed) ServeHTTP

func (seed *Seed) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Seed) Start

func (seed *Seed) Start() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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