Better comments
This commit is contained in:
parent
3813360d91
commit
57c6abe86c
7
auth.go
7
auth.go
|
@ -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 {
|
||||||
|
|
2
godoc.go
2
godoc.go
|
@ -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.
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue