server

package
v0.0.0-...-3b98bfd Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiKey

type ApiKey []byte

func NewApiKey

func NewApiKey(key string) ApiKey

Creates an ApiKey that is later used to validate against client supplied keys.

func (ApiKey) Validate

func (k ApiKey) Validate(key string) bool

Validates that the supplied key matches the expected one.

type KikConnectionHolder

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

I'm struggling to think of a better name. Suggest me one.

func NewConnectionHolder

func NewConnectionHolder() *KikConnectionHolder

func (*KikConnectionHolder) DisconnectAll

func (c *KikConnectionHolder) DisconnectAll()

Disconnects all clients

func (*KikConnectionHolder) DisconnectIp

func (c *KikConnectionHolder) DisconnectIp(ip string)

Disconnects all clients under a given IP address.

type Server

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

func (*Server) Await

func (s *Server) Await()

Awaits completion of the main loop, blocking the current goroutine.

type ServerConfig

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

func NewInsecure

func NewInsecure(port int) *ServerConfig

New builder for a server that will open a plain text connection on the given port.

func NewTLS

func NewTLS(port int, config *tls.Config) *ServerConfig

New builder for a server that will open a TLS (secure) connection on the given port with the given config.

func (*ServerConfig) Start

func (s *ServerConfig) Start() *Server

Starts the server. Call Server.Await() to block, which is required for CLI.

func (*ServerConfig) WithAntiSpam

func (s *ServerConfig) WithAntiSpam() *ServerConfig

All clients will be protected by rate limiting. If a peer sends too many messages to the client, the server will intercept and delete them.

func (*ServerConfig) WithAntiSpamFunc

func (s *ServerConfig) WithAntiSpamFunc(f func(k *node.InitialStreamTag) bool) *ServerConfig

All clients matching f will be protected by rate limiting. If a peer sends too many messages to the client, the server will intercept and delete them.

func (*ServerConfig) WithApiKey

func (s *ServerConfig) WithApiKey(apiKey string) *ServerConfig

When specified, only whitelisted accounts and clients that authenticate with the 'x-api-key' header matching the apiKey will be allowed to connect.

func (*ServerConfig) WithBanHosts

func (s *ServerConfig) WithBanHosts() *ServerConfig

Hosts will be banned using iptables if they send malformed packets, fail integrity checks or are IP scrapers

func (*ServerConfig) WithCustomBanner

func (s *ServerConfig) WithCustomBanner() *ServerConfig

Server will include a banner in the stream header upon successful authentication.

func (*ServerConfig) WithCustomDialer

func (s *ServerConfig) WithCustomDialer(f func(k *node.InitialStreamTag, dialer *net.Dialer, network string, addr string, config *tls.Config) (*tls.Conn, error)) *ServerConfig

Server will use your custom dialer to connect to Kik.

dialer, network, addr, and config can be used to call tls.DialWithDialer.

func (*ServerConfig) WithInitStreamTagGenerator

func (s *ServerConfig) WithInitStreamTagGenerator(f func(k *node.InitialStreamTag) string) *ServerConfig

Server will use your custom dialer to connect to Kik.

dialer, network, addr, and config can be used to call tls.DialWithDialer.

func (*ServerConfig) WithInterface

func (s *ServerConfig) WithInterface(iface net.Interface, allowedIps []string) *ServerConfig

Use a custom network interface to dial to Kik. allowedIps is the list of IPs that clients are allowed to use via the 'x-interface' stream header. Set to nil to allow all addresses under the iface.

func (*ServerConfig) WithWhitelist

func (s *ServerConfig) WithWhitelist(whitelist []string) *ServerConfig

JIDs / device IDs on this list aren't subject to API key restrictions.

func (*ServerConfig) WithXmppLogging

func (s *ServerConfig) WithXmppLogging() *ServerConfig

Server logs all XMPP sent and received to the 'xmpp' directory.

func (*ServerConfig) WithXmppLoggingFunc

func (s *ServerConfig) WithXmppLoggingFunc(f func(k *node.InitialStreamTag) bool) *ServerConfig

Server logs all XMPP sent and received to the 'xmpp' directory for all clients matching f

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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