econ

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthenticationFailed = errors.New("authentication failed")
)

Functions

This section is empty.

Types

type Conn

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

Conn is the telnet connection to a teeworlds external console terminal(econ)

func DialTo

func DialTo(address, password string, options ...Option) (conn *Conn, err error)

DialTo creates a new econ connection that can be used to write or read lines from the teeworlds server via the external console. (The New function is a wrapper around DialTo) address is the <IP>:<PORT(ec_port)> address the password is the one you set via: ec_password You may want to decrease the ec_auth_timeout in order to get disconnected faster and not to block any of the 4 existing econ slots. You can also set your ec_bantime to anything other than 0 in order to ban people that try to connect to you external console and try incorrect credentials ec_output_level [1,2] allows to increase the logging level of your external console. This allows for more verbose econ output parsing

func (*Conn) Close added in v1.1.0

func (c *Conn) Close() (err error)

Close must be called when the connection is to be quit

func (*Conn) ReadLine

func (c *Conn) ReadLine() (line string, err error)

ReadLine reads a line from the external console if the connection is lost, it attempts to reconnect multiple times before trying to read the line again.

func (*Conn) WriteLine

func (c *Conn) WriteLine(line string) (err error)

WriteLine writes a line to the external console and forces its execution by appending a \n

type Option added in v1.4.0

type Option func(*Conn)

func WithContext added in v1.4.0

func WithContext(ctx context.Context) Option

WithContext sets the context for the connection

func WithMaxReconnectDelay added in v1.4.0

func WithMaxReconnectDelay(delay time.Duration) Option

WithMaxReconnectDelay sets the maximum delay between reconnects

func WithOnConnectCommands added in v1.4.0

func WithOnConnectCommands(commands ...string) Option

WithOnConnectCommands sets the commands to be executed on connect

Jump to

Keyboard shortcuts

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