Documentation
¶
Index ¶
- Constants
- Variables
- type AuthenticationType
- type Configs
- type Context
- type DebugHandler
- type Event
- type Handler
- type Log
- type Option
- type Options
- func (v *Options) AddHostKey(k *crypto.PrivateKey) *Options
- func (v *Options) AddMiddleware(fs ...Handler) *Options
- func (v *Options) Changes() <-chan struct{}
- func (v *Options) GetClientAuth() bool
- func (v *Options) GetHostKeys() []*crypto.PrivateKey
- func (v *Options) GetListenAddr() string
- func (v *Options) GetMetadata(k string) string
- func (v *Options) GetMiddlewares() []Handler
- func (v *Options) GetPasswordAuthentication() bool
- func (v *Options) GetProtocol() int
- func (v *Options) GetRSAAuthentication() bool
- func (v *Options) GetServerID() string
- func (v *Options) SetClientAuth(enable bool) *Options
- func (v *Options) SetListenAddr(addr string) *Options
- func (v *Options) SetPasswordAuthentication(enable bool) *Options
- func (v *Options) SetProtocol(protocol int) *Options
- func (v *Options) SetRSAAuthentication(enable bool) *Options
- func (v *Options) SetServerID(s string) *Options
- type Server
- type Winsize
Constants ¶
const ( EventServerStart string = "server-start" EventServerStop = "server-stop" EventServerStarted = "server-started" EventServerStopped = "server-stopped" EventReceiveSignal = "receive-signal" )
Event topics
const ( TraceAuthentication string = "authentication" TracePasswordAuthentication = "password-authentication" TraceRSAAuthentication = "rsa-authentication" TraceKeyboardInteractiveAuthentication = "keyboardinteractive-authentication" TraceHandshake = "handshake" TraceChannel = "channel" TraceConnect = "connect" TraceDisconnect = "disconnect" )
Log topics
Variables ¶
var (
ErrUnauthentized = errors.Unauthorized(namespace, "authorization has been refused")
)
Error messages
Functions ¶
This section is empty.
Types ¶
type AuthenticationType ¶
type AuthenticationType int8
AuthenticationType type
const ( AuthenticationPassword AuthenticationType AuthenticationPublicKey AuthenticationKeyboardInteractive )
Authentication types
func (AuthenticationType) String ¶
func (v AuthenticationType) String() string
type Configs ¶
type Configs struct {
// contains filtered or unexported fields
}
Configs struct
func (*Configs) AuthLogCallback ¶
func (v *Configs) AuthLogCallback(md ssh.ConnMetadata, method string, err error)
AuthLogCallback func
func (*Configs) PasswordCallback ¶
func (v *Configs) PasswordCallback(md ssh.ConnMetadata, pass []byte) (*ssh.Permissions, error)
PasswordCallback func
func (*Configs) PublicKeyCallback ¶
func (v *Configs) PublicKeyCallback(md ssh.ConnMetadata, key ssh.PublicKey) (*ssh.Permissions, error)
PublicKeyCallback func
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context struct
func (*Context) RemoteAddr ¶
RemoteAddr returns remote address
type DebugHandler ¶
type DebugHandler func(md ssh.ConnMetadata, method string, err error)
DebugHandler logging handler
type Option ¶
type Option func(*Options)
Option func
func PasswordAuthentication ¶
PasswordAuthentication option
type Options ¶
type Options struct {
sync.RWMutex
// Server Id
ServerID string
// NoClientAuth is true if clients are allowed to connect without
// authenticating.
NoClientAuth bool
// Enable password authentication
PasswordAuthentication bool
// Enable rsa key authentication
RSAAuthentication bool
// Secure Shell server listen addr
ListenAddr string
// Secure Shell protocol version
Protocol int
// HostKeys
HostKeys []*crypto.PrivateKey
// Metadata
Metadata map[string]string
// Middlewares
Middlewares []Handler
// contains filtered or unexported fields
}
Options for Secure Shell
func (*Options) AddHostKey ¶
func (v *Options) AddHostKey(k *crypto.PrivateKey) *Options
AddHostKey to set host private key
func (*Options) AddMiddleware ¶
AddMiddleware to add auth middleware
func (*Options) GetClientAuth ¶
GetClientAuth to return client auth settings
func (*Options) GetHostKeys ¶
func (v *Options) GetHostKeys() []*crypto.PrivateKey
GetHostKeys to return host private key
func (*Options) GetListenAddr ¶
GetListenAddr to return listen address
func (*Options) GetMetadata ¶
GetMetadata to return metadata data
func (*Options) GetMiddlewares ¶
GetMiddlewares to return middlewares
func (*Options) GetPasswordAuthentication ¶
GetPasswordAuthentication to return password authentication setting
func (*Options) GetProtocol ¶
GetProtocol to return protocol version
func (*Options) GetRSAAuthentication ¶
GetRSAAuthentication to return rsa authentication setting
func (*Options) GetServerID ¶
GetServerID to return server id
func (*Options) SetClientAuth ¶
SetClientAuth to enable or disable client authentication [true => enable]
func (*Options) SetListenAddr ¶
SetListenAddr to set listen port
func (*Options) SetPasswordAuthentication ¶
SetPasswordAuthentication to enable or disable password authentication
func (*Options) SetProtocol ¶
SetProtocol to set secure shell protocol
func (*Options) SetRSAAuthentication ¶
SetRSAAuthentication to enable or disable rsa key authentication
func (*Options) SetServerID ¶
SetServerID to set server reference id