Documentation ¶
Index ¶
- Variables
- func Listen(network, laddr string, config *Config) (net.Listener, error)
- func ListenTLS(network, laddr string, tlsConfig *tls.Config, config *Config) (net.Listener, error)
- func NewListener(inner net.Listener, config *Config) net.Listener
- type Config
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) ConnectionState() ConnectionState
- func (c *Conn) Handshake() error
- func (c *Conn) HandshakeContext(ctx context.Context) error
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) NetConn() net.Conn
- func (c *Conn) Read(b []byte) (n int, err error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) Write(b []byte) (n int, err error)
- type ConnectionState
- type Mechanism
- type MechanismClient
- type MechanismServer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrHandshakeAborted gets returned from handshake if the // client or server aborted the ongoing handshake ErrHandshakeAborted = errors.New("handshake got aborted") )
Functions ¶
func Listen ¶
Listen creates a SASL listener by calling NewListener after using net.Listen to create the inner listener
Types ¶
type Config ¶
type Config struct {
Mechanisms []*Mechanism
}
Config describes the the configuration used for establishing a SASL connection. It contains a list of supported mechanisms.
type Conn ¶
Conn describes a SASL authenticated connection. It implements the net.Conn interface
func Client ¶
Client returns a new SASL connection using the given net.Conn as the underlying transport. It will act as the client.
func Dial ¶
Dial connects to the given network address using net.Dial and initiates a handshake returning the resulting SASL connection
func DialWithDialer ¶
DialWithDialer connects to a given network address using net.Dial and initiates a handshake returning the resulting SASL connection
func Server ¶
Server returns a new SASL connection using the given net.Conn as the underlying transport. It will act as the server.
func (*Conn) ConnectionState ¶
func (c *Conn) ConnectionState() ConnectionState
ConnectionState returns the connection state of the connection
func (*Conn) Handshake ¶
Handshake calls HandshakeContext internally by using context.Background()
For controlling canceling or timeouts use HandshakeContext instead
func (*Conn) HandshakeContext ¶
HandshakeContext initiates the handshake based on the connection role as client or server if it has not been run.
Since it is called as part of Read and Write it is mostly not neccessary to call it manually.
func (*Conn) Read ¶
Read reads data from the connection.
As Read calls Handshake, in order to prevent indefinite blocking a deadline must be set for both Read and Write before Read is called when the handshake has not yet completed. See SetDeadline, SetReadDeadline, and SetWriteDeadline.
func (*Conn) RemoteAddr ¶
RemoteAddr returns the remote address of the inner connection
func (*Conn) SetDeadline ¶
SetDeadline sets the read and write deadline for the inner connection
func (*Conn) SetReadDeadline ¶
SetReadDeadline sets the read deadline for the inner connection
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline sets the write deadline for the inner connection
type ConnectionState ¶
type ConnectionState struct { // HandshakeComplete gives the status of the handshake HandshakeComplete bool // NegotiatedMechanism contains the mechanism negotiated // during the handshake. If it has not yet been selected // it is "" NegotiatedMechanism string }
ConnectionState describes the state of a SASL connection
type Mechanism ¶
type Mechanism struct { // Name is the name of the mechanism which must comply the // naming scheme defined in RFC4422 section 3.1 Name string // Client specifies the client implementation for this mechanism Client MechanismClient // Server specifies the server implementation for this mechanism Server MechanismServer }
Mechanism describes a SASL mechanism as describes in RFC4422
type MechanismClient ¶
type MechanismClient sasl.Client
MechanismClient is redefined from the go-sasl library
type MechanismServer ¶
type MechanismServer sasl.Server
MechanismServer is redefined from the go-sasl library