node

package
v0.0.0-...-90af18b Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTML_BODY = `` /* 1016-byte string literal not displayed */

	HTML_END = `` /* 237-byte string literal not displayed */

)
View Source
const (
	MULTICAST_ADDRESS     = "239.6.6.6:1337"
	MULTICAST_BUFFER_SIZE = 4096

	NODE_ANNOUNCE_COMMAND = "\x01"
	HEADER                = "\x60\x0D\xF0\x0D"
	MIN_PACKET_SIZE       = 6

	EXPIRE_TIMEOUT_SEC    = 50
	ANNOUNCE_INTERVAL_SEC = 10
)

Variables

This section is empty.

Functions

func NewAnnouncePacket

func NewAnnouncePacket(n *NodeInfo) (string, error)

func Serve

func Serve(conf *config.Config)

Types

type Announcer

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

func (*Announcer) Start

func (a *Announcer) Start(nodeList *list.List)

type FileServerResponseInterceptor

type FileServerResponseInterceptor struct {
	OriginalWriter http.ResponseWriter
	IndexBuffer    *bytes.Buffer
}

func (*FileServerResponseInterceptor) Header

func (*FileServerResponseInterceptor) Write

func (f *FileServerResponseInterceptor) Write(content []byte) (int, error)

func (*FileServerResponseInterceptor) WriteHeader

func (f *FileServerResponseInterceptor) WriteHeader(status int)

type NodeInfo

type NodeInfo struct {
	Id            string `json:"nodeId"`
	Address       string `json:"ipAddress"`
	WebPort       string `json:"webPort"`
	LastMulticast int64  `json:"-"`
}

func ParseAnnouncePacket

func ParseAnnouncePacket(size int, addr *net.UDPAddr, packet []byte) (*NodeInfo, error)

Jump to

Keyboard shortcuts

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