Version: v1.2.1 Latest Latest

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

Go to latest
Published: Mar 6, 2021 License: MIT Imports: 5 Imported by: 0




View Source
const (

	// heartbeat between controller and edge

	// edge register to controller

	// controller tell edge that new edge join

	// controller tell edge that edge leave

	// edge report subhost of it to controller

	// alarm report

	// add route

	// del route


This section is empty.


func ReadJSON

func ReadJSON(conn net.Conn, obj interface{}) error

ReadJSON wraps Read with json decoder

func Write

func Write(conn net.Conn, cmd int, body []byte) error

Write to net connection cmd: header.cmd body: payload

func WriteJSON

func WriteJSON(conn net.Conn, cmd int, obj interface{}) error

WriteJSON wraps Write with json encoder


type AddRouteMsg added in v1.2.1

type AddRouteMsg struct {
	// dst cidr
	Cidr string
	// next hop edge listen address
	// ip:port
	Nexthop string

controller deploy route added to edges

type BroadcastOfflineMsg

type BroadcastOfflineMsg struct {
	// offlined edge host address
	ListenAddr string

	// offlined edge network subnet
	Cidr string

broadcase edge offline once edge keepalive faile controller will broadcase edge offline msg to all online edges

type BroadcastOnlineMsg

type BroadcastOnlineMsg struct {
	// onlined edge listen address(udp://ip:port)
	ListenAddr string

	// offline edge network subnet(
	Cidr string

broadcast edge online once edge register success controller will broadcast edge online msg to all online edges.

type CSPInfo added in v1.2.1

type CSPInfo struct {
	CspType      proto.CSPType
	AccessKey    string
	AccessSecret string

type DelRouteMsg added in v1.2.1

type DelRouteMsg AddRouteMsg

controller deploy route deleted to edges

type Edge added in v1.2.1

type Edge struct {
	ListenAddr string
	Cidr       string

edge information

type Header [4]byte

version: 1byte cmd: 1byte body len: 2bytes

func Read

func Read(conn net.Conn) (Header, []byte, error)

Read from net connection return header, body and error

func (Header) Bodylen

func (h Header) Bodylen() int

func (Header) Cmd

func (h Header) Cmd() int

func (Header) Version

func (h Header) Version() int

type Heartbeat

type Heartbeat struct{}

type RegisterReply

type RegisterReply struct {
	EdgeList []*Edge
	CSPInfo  *CSPInfo
	Routes   []*proto.Route

reply for edge register req

func (*RegisterReply) String

func (r *RegisterReply) String() string

type RegisterReq

type RegisterReq struct {
	// edge name
	Name      string
	SecretKey string
	PublicIP  string

edge register req

type ReportMsg added in v1.2.1

type ReportMsg struct {
	Timestamp  int64
	CPU        int32
	Mem        int32
	TrafficIn  int64
	TrafficOut int64

edge report host edge report host information to controller controller get topology

host1                    host1'
     \                  /
      edge1 ---- edge2
     /                  \
host2                    host2'

Source Files


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL