tcp

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: Unlicense Imports: 5 Imported by: 0

Documentation

Overview

Not to be confused with Transmission Control Protocol!

Index

Constants

This section is empty.

Variables

View Source
var (
	ListenAddr    string // Contains the IP address to listen on.
	HistoryLength int    // Contains the maximum amount of messages that will be stored.

	DiscordChannel chan []string // Channel through which messages get sent to Discord.
	TCPChannel     chan []string // Channel through which messages get sent to TCP users.
)

Functions

func GetHead

func GetHead() (head uint32)

GetHead returns the current message head.

func GetMessage

func GetMessage(index uint32) (username string, content string)

GetMessage looks up the message at the specified index and returns it if it is stored in the LRU cache.

func StartServer

func StartServer()

StartServer starts the TCP server portion of the bridge.

Types

type Message

type Message struct {
	Username string
	Content  string
}

Message represents a message. A message is made up of a sender (represented by the username) and its content.

type Packet

type Packet struct {
	Magic      [4]byte
	PacketType byte
	Payload    [1495]byte
}

Packet represents a TCP packet.

Source Files

  • server.go

Jump to

Keyboard shortcuts

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