Better comments

This commit is contained in:
UlisseMini 2019-01-25 12:07:34 -05:00 committed by Andrey Petrov
parent 3813360d91
commit 57c6abe86c
4 changed files with 10 additions and 4 deletions

View File

@ -13,10 +13,11 @@ import (
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
) )
// The error returned a key is checked that is not whitelisted, with whitelisting required. // ErrNotWhitelisted Is the error returned when a key is checked that is not whitelisted,
// when whitelisting is enabled.
var ErrNotWhitelisted = errors.New("not whitelisted") var ErrNotWhitelisted = errors.New("not whitelisted")
// The error returned a key is checked that is banned. // ErrBanned is the error returned when a key is checked that is banned.
var ErrBanned = errors.New("banned") var ErrBanned = errors.New("banned")
// newAuthKey returns string from an ssh.PublicKey used to index the key in our lookup. // newAuthKey returns string from an ssh.PublicKey used to index the key in our lookup.
@ -182,7 +183,7 @@ func (a *Auth) Banned() (ip []string, fingerprint []string, client []string) {
return return
} }
// Ban will set an IP address as banned. // BanAddr will set an IP address as banned.
func (a *Auth) BanAddr(addr net.Addr, d time.Duration) { func (a *Auth) BanAddr(addr net.Addr, d time.Duration) {
authItem := set.StringItem(newAuthAddr(addr)) authItem := set.StringItem(newAuthAddr(addr))
if d != 0 { if d != 0 {

View File

@ -1,5 +1,5 @@
/* /*
sshchat package is an implementation of an ssh server which serves a chat room Package sshchat is an implementation of an ssh server which serves a chat room
instead of a shell. instead of a shell.
sshd subdirectory contains the ssh-related pieces which know nothing about chat. sshd subdirectory contains the ssh-related pieces which know nothing about chat.

View File

@ -26,18 +26,22 @@ func NewIdentity(conn sshd.Connection) *Identity {
} }
} }
// ID returns the name for the Identity
func (i Identity) ID() string { func (i Identity) ID() string {
return i.id return i.id
} }
// SetID Changes the Identity's name
func (i *Identity) SetID(id string) { func (i *Identity) SetID(id string) {
i.id = id i.id = id
} }
// SetName Changes the Identity's name
func (i *Identity) SetName(name string) { func (i *Identity) SetName(name string) {
i.SetID(name) i.SetID(name)
} }
// Name returns the name for the Identity
func (i Identity) Name() string { func (i Identity) Name() string {
return i.id return i.id
} }

View File

@ -9,6 +9,7 @@ import (
var logger *golog.Logger var logger *golog.Logger
// SetLogger sets the package logging to use l.
func SetLogger(l *golog.Logger) { func SetLogger(l *golog.Logger) {
logger = l logger = l
} }