candy

package
v0.0.0-...-f57b53e Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AUTH      uint8 = 0
	FORWARD   uint8 = 1
	DHCP      uint8 = 2
	PEER      uint8 = 3
	VMAC      uint8 = 4
	DISCOVERY uint8 = 5
	GENERAL   uint8 = 255
)

Variables

This section is empty.

Functions

func DeleteDomain

func DeleteDomain(name string)

func Sync

func Sync()

func UpdateLocation

func UpdateLocation(device *Device, ip string)

func WebsocketMiddleware

func WebsocketMiddleware() gin.HandlerFunc

Types

type AuthMessage

type AuthMessage struct {
	Type      uint8    `struc:"uint8"`
	IP        uint32   `struc:"uint32"`
	Timestamp int64    `struc:"int64"`
	Hash      [32]byte `struc:"[32]byte"`
}

type DHCPMessage

type DHCPMessage struct {
	Type      uint8    `struc:"uint8"`
	Timestamp int64    `struc:"int64"`
	Cidr      []byte   `struc:"[32]byte"`
	Hash      [32]byte `struc:"[32]byte"`
}

type Device

type Device struct {
	Domain        string `gorm:"primaryKey"`
	VMac          string `gorm:"primaryKey"`
	IP            string
	Country       string
	Region        string
	Online        bool
	ConnUpdatedAt time.Time
	RX            uint64
	TX            uint64
	OS            string
	Version       string
	HostName      string
	// contains filtered or unexported fields
}

type DiscoveryMessage

type DiscoveryMessage struct {
	Type uint8  `struc:"uint8"`
	Src  uint32 `struc:"uint32"`
	Dst  uint32 `struc:"uint32"`
}

type Domain

type Domain struct {
	Name      string `gorm:"primaryKey"`
	Password  string
	DHCP      string
	Broadcast bool
	// contains filtered or unexported fields
}

func GetDomain

func GetDomain(name string) *Domain

type ForwardMessage

type ForwardMessage struct {
	Type   uint8    `struc:"uint8"`
	Unused [12]byte `struc:"[12]byte"`
	Src    uint32   `struc:"uint32"`
	Dst    uint32   `struc:"uint32"`
}

type GeneralMessage

type GeneralMessage struct {
	Type    uint8  `struc:"uint8"`
	Subtype uint8  `struc:"uint8"`
	Extra   uint16 `struc:"uint16"`
	Src     uint32 `struc:"uint32"`
	Dst     uint32 `struc:"uint32"`
}

type PeerConnMessage

type PeerConnMessage struct {
	Type uint8  `struc:"uint8"`
	Src  uint32 `struc:"uint32"`
	Dst  uint32 `struc:"uint32"`
	IP   uint32 `struc:"uint32"`
	Port uint16 `struc:"uint16"`
}

type VMacMessage

type VMacMessage struct {
	Type      uint8    `struc:"uint8"`
	VMac      string   `struc:"[16]byte"`
	Timestamp int64    `struc:"int64"`
	Hash      [32]byte `struc:"[32]byte"`
}

type Websocket

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

func (*Websocket) UpdateReadDeadline

func (ws *Websocket) UpdateReadDeadline() error

func (*Websocket) WriteMessage

func (ws *Websocket) WriteMessage(buffer []byte) error

func (*Websocket) WritePong

func (ws *Websocket) WritePong(buffer []byte) error

Jump to

Keyboard shortcuts

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