connection

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	net.Conn
	Crypt *crypto.CryptState
	// contains filtered or unexported fields
}

Conn represents a Mumble client connection.

func New

func New(c net.Conn, crypt *crypto.CryptState, onClose func(*Conn)) *Conn

New creates a new connection.

func (*Conn) CertificateHash

func (c *Conn) CertificateHash() string

CertificateHash returns the SHA-1 hex fingerprint of the client's TLS certificate, or empty if unavailable.

func (*Conn) ClientCryptoModes

func (c *Conn) ClientCryptoModes() uint32

ClientCryptoModes returns the client's advertised crypto mode bitmask (0 = legacy only).

func (*Conn) Close

func (c *Conn) Close() error

Close closes the connection and notifies onClose.

func (*Conn) Run

func (c *Conn) Run(ctx context.Context, handler protocol.HandlerTable) error

Run runs the read and write loops.

func (*Conn) SessionID

func (c *Conn) SessionID() uint32

SessionID returns the session ID (0 until authenticated).

func (*Conn) SetActive

func (c *Conn) SetActive()

SetActive sets state to Active.

func (*Conn) SetClientCryptoModes

func (c *Conn) SetClientCryptoModes(m uint32)

SetClientCryptoModes stores the client's advertised crypto mode bitmask.

func (*Conn) SetSessionID

func (c *Conn) SetSessionID(id uint32)

SetSessionID sets the session ID.

func (*Conn) SetUser

func (c *Conn) SetUser(name string, userID uint32, channelID uint32)

SetUser sets the user info.

func (*Conn) State

func (c *Conn) State() State

State returns the connection state.

func (*Conn) UserChannel

func (c *Conn) UserChannel() uint32

UserChannel returns the user's channel ID.

func (*Conn) UserName

func (c *Conn) UserName() string

UserName returns the username.

func (*Conn) WriteMessage

func (c *Conn) WriteMessage(msgType protocol.MessageType, msg messages.Message) error

WriteMessage queues a message for sending.

func (*Conn) WriteRaw

func (c *Conn) WriteRaw(msgType protocol.MessageType, payload []byte) error

WriteRaw queues raw payload for sending.

type State

type State int

State is the connection state.

const (
	StateAuthenticating State = iota
	StateActive
	StateClosed
)

Jump to

Keyboard shortcuts

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