handshake

package
v1.49.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ResponseEOF = 0xfe
	ResponseOK  = 0x00
	ResponseERR = 0xff
)
View Source
const (
	CapabilityServerMySQL uint32 = 1 << iota
	CapabilityServerPostgres
)

Capability flags

View Source
const (
	// 1000 - 1199 server errors
	// unknown
	ErrUnknownError = 1000

	// internal
	ErrInternalError = 1100

	// 1200 -  grant errors
	ErrGrantInactiveError = 1200
	ErrNoGrantOutputError = 1201

	// 1300 -  grant errors
	ErrUserIdentityError = 1300
)
View Source
const (
	// CFAuthToken transmits the cf auth token in the clear.
	CFAuthToken = "cf_auth_token"
)

Supported auth forms.

View Source
const (
	// MaxPacketSize is the maximum payload length of a packet
	// the server supports.
	MaxPacketSize = (1 << 24) - 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewHandshakeClient

func NewHandshakeClient(conn net.Conn, grantID string, tokenSource oauth2.TokenSource) *Client

func (*Client) Handshake

func (c *Client) Handshake() (*ServerHandshake, error)

type ClientHandshake

type ClientHandshake struct {
	// contains filtered or unexported fields
}

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewHandshakeServer

func NewHandshakeServer(conn net.Conn, connectionID uint32, sessionValidator SessionValidator) *Server

func (*Server) Handshake

func (s *Server) Handshake() error

type ServerError

type ServerError struct {
	Num     int
	Message string
}

ServerError is a known error type

func CannotVerifyUserIdentityError

func CannotVerifyUserIdentityError() *ServerError

func GrantInactiveError

func GrantInactiveError() *ServerError

func InternalServerError

func InternalServerError() *ServerError

func NoGrantOutputError

func NoGrantOutputError() *ServerError

func (*ServerError) Error

func (se *ServerError) Error() string

Error implements the error interface

type ServerHandshake

type ServerHandshake struct {
	ConnectionID       uint32
	ServerCapabilities uint32
	AuthMethod         string
	ServerVersion      string
	ProtocolVersion    int
}

type SessionValidator

type SessionValidator interface {
	Validate(token string, grantID string) error
}

type SessionValidatorFunc

type SessionValidatorFunc func(token string, grantID string) error

The HandlerFunc type is an adapter to allow the use of ordinary functions as SessionValidators

func (SessionValidatorFunc) Validate

func (f SessionValidatorFunc) Validate(token string, grantID string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL