Documentation ¶
Overview ¶
sshchat package is an implementation of an ssh server which serves a chat room instead of a shell.
sshd subdirectory contains the ssh-related pieces which know nothing about chat.
chat subdirectory contains the chat-related pieces which know nothing about ssh.
The Host type is the glue between the sshd and chat pieces.
Index ¶
- Variables
- func GetPrompt(user *message.User) string
- func SetLogger(l *golog.Logger)
- type Auth
- func (a *Auth) AllowAnonymous() bool
- func (a *Auth) Ban(key ssh.PublicKey, d time.Duration)
- func (a *Auth) BanAddr(addr net.Addr, d time.Duration)
- func (a *Auth) BanFingerprint(authkey string, d time.Duration)
- func (a *Auth) Check(addr net.Addr, key ssh.PublicKey) (bool, error)
- func (a *Auth) IsOp(key ssh.PublicKey) bool
- func (a *Auth) Op(key ssh.PublicKey, d time.Duration)
- func (a *Auth) Whitelist(key ssh.PublicKey, d time.Duration)
- type Host
- func (h *Host) AutoCompleteFunction(u *message.User) func(line string, pos int, key rune) (newLine string, newPos int, ok bool)
- func (h *Host) Connect(term *sshd.Terminal)
- func (h *Host) GetUser(name string) (*message.User, bool)
- func (h *Host) InitCommands(c *chat.Commands)
- func (h *Host) Serve()
- func (h *Host) SetMotd(motd string)
- func (h *Host) SetTheme(theme message.Theme)
- type Identity
Constants ¶
This section is empty.
Variables ¶
var ErrBanned = errors.New("banned")
The error returned a key is checked that is banned.
var ErrNotWhitelisted = errors.New("not whitelisted")
The error returned a key is checked that is not whitelisted, with whitelisting required.
Functions ¶
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth stores lookups for bans, whitelists, and ops. It implements the sshd.Auth interface.
func (*Auth) AllowAnonymous ¶
AllowAnonymous determines if anonymous users are permitted.
func (*Auth) BanFingerprint ¶
BanFingerprint will set a public key fingerprint as banned.
type Host ¶
type Host struct { *chat.Room // Version string to print on /version Version string // contains filtered or unexported fields }
Host is the bridge between sshd and chat modules TODO: Should be easy to add support for multiple rooms, if we want.
func NewHost ¶
func NewHost(listener *sshd.SSHListener, auth *Auth) *Host
NewHost creates a Host on top of an existing listener.
func (*Host) AutoCompleteFunction ¶
func (h *Host) AutoCompleteFunction(u *message.User) func(line string, pos int, key rune) (newLine string, newPos int, ok bool)
AutoCompleteFunction returns a callback for terminal autocompletion
func (*Host) InitCommands ¶
InitCommands adds host-specific commands to a Commands container. These will override any existing commands.
type Identity ¶
type Identity struct { sshd.Connection // contains filtered or unexported fields }
Identity is a container for everything that identifies a client.
func NewIdentity ¶
func NewIdentity(conn sshd.Connection) *Identity
NewIdentity returns a new identity object from an sshd.Connection.
func (Identity) WhoisAdmin ¶
WhoisAdmin returns a whois description for admin users.