Documentation
¶
Overview ¶
Package gremconnect has the connection related structs and functions.
Functions in this package relate to authentication and connection to the graph database of choice.
This package also includes the available dialers to use for the Grammes client such as the websocket dialer.
Index ¶
- Variables
- func PackageRequest(req Request, versionNumber string) (msg []byte, err error)
- type Auth
- type AuthInfo
- type AuthProvider
- type Dialer
- type HTTPAuth
- type OptAuth
- type Request
- type Response
- type WebSocket
- func (ws *WebSocket) Address() string
- func (ws *WebSocket) Auth() (*Auth, error)
- func (ws *WebSocket) Close() error
- func (ws *WebSocket) Connect() error
- func (ws *WebSocket) GetQuit() chan struct{}
- func (ws *WebSocket) IsConnected() bool
- func (ws *WebSocket) IsDisposed() bool
- func (ws *WebSocket) Ping(errs chan error)
- func (ws *WebSocket) Read() (msg []byte, err error)
- func (ws *WebSocket) SetAuth(user, pass string)
- func (ws *WebSocket) SetCompression(enableCompression bool)
- func (ws *WebSocket) SetHTTPAuth(provider AuthProvider)
- func (ws *WebSocket) SetHandshakeTimeout(handshakeTimeout time.Duration)
- func (ws *WebSocket) SetPingInterval(interval time.Duration)
- func (ws *WebSocket) SetReadBufferSize(readBufferSize int)
- func (ws *WebSocket) SetReadingWait(interval time.Duration)
- func (ws *WebSocket) SetTLSConfig(conf *tls.Config)
- func (ws *WebSocket) SetTimeout(interval time.Duration)
- func (ws *WebSocket) SetWriteBufferResizing(writeBufferResizing bool)
- func (ws *WebSocket) SetWriteBufferSize(writeBufferSize int)
- func (ws *WebSocket) SetWritingWait(interval time.Duration)
- func (ws *WebSocket) Write(msg []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( // GenUUID is a monkey patched function for the Google UUIDv4 generator. GenUUID = uuid.NewUUID )
Functions ¶
Types ¶
type AuthInfo ¶
AuthInfo holds all the information needed to use SASL authentication with the Gremlin server. ChallengeID is the requestID in the 407 status (AUTHENTICATE) response
type AuthProvider ¶ added in v1.3.3
type Dialer ¶
type Dialer interface { // Actions Connect() error Close() error Write(msg []byte) error Read() (msg []byte, err error) Ping(errs chan error) // Checkers IsConnected() bool IsDisposed() bool // Getters Auth() (*Auth, error) Address() string GetQuit() chan struct{} // Configuration Setters SetHTTPAuth(provider AuthProvider) SetAuth(username string, password string) SetTimeout(interval time.Duration) SetPingInterval(interval time.Duration) SetWritingWait(interval time.Duration) SetReadingWait(interval time.Duration) SetWriteBufferSize(writeBufferSize int) SetWriteBufferResizing(writeBufferResizing bool) SetReadBufferSize(readBufferSize int) SetHandshakeTimeout(handshakeTimeout time.Duration) SetCompression(enableCompression bool) SetTLSConfig(conf *tls.Config) }
Dialer will be used to dial in a connection between the client and gremlin server without directly using a websocket. This leaves room for mocking and altered methods of connecting to the server.
func NewWebSocketDialer ¶
NewWebSocketDialer returns a new WebSocket dialer to use when establishing a connection to the Gremlin server. This function also assigns default values to the websocket if they're not assigned by DialerConfig functions.
type OptAuth ¶
OptAuth holds data about the authentication
func OptAuthEnv ¶
func OptAuthEnv() OptAuth
OptAuthEnv sets authentication info from environment variables GREMLIN_USER and GREMLIN_PASS
func OptAuthUserPass ¶
OptAuthUserPass sets authentication information from username and password
type Request ¶
type Request struct { RequestID string `json:"requestId"` Op string `json:"op"` Processor string `json:"processor"` Args map[string]interface{} `json:"args"` }
Request is a container for all evaluation request parameters to be sent to the Gremlin Server.
type Response ¶
Response is the structure representation of the response json received from the Gremlin-Server.
func MarshalResponse ¶
MarshalResponse creates a Response struct for every incoming Response for further manipulation
type WebSocket ¶
WebSocket will hold all of the data used to dial to the gremlin server and sustain a stable connection by pinging it regularly.
func (*WebSocket) Auth ¶
Auth returns the websocket's authentication information if it's on a secure connection.
func (*WebSocket) Close ¶
Close disposes the websocket and closes the quit channel to signal the websocket's ping selection.
func (*WebSocket) Connect ¶
Connect will setup the gorilla websocket and other configurations to establish a connection to the given address.
func (*WebSocket) GetQuit ¶
func (ws *WebSocket) GetQuit() chan struct{}
GetQuit returns the quit channel so the websocket can communicate to the client that the connection has quit.
func (*WebSocket) IsConnected ¶
IsConnected returns whether the given websocket has an established connection.
func (*WebSocket) IsDisposed ¶
IsDisposed returns whether the given websocket has been disposed of its use.
func (*WebSocket) Ping ¶
Ping runs a routine ping check to the established connection and sends error channel a signal if there's a detected error if not/how the server responds.
func (*WebSocket) Read ¶
Read uses the gorilla function to read a response from the established connection.
func (*WebSocket) SetCompression ¶ added in v1.3.3
func (*WebSocket) SetHTTPAuth ¶ added in v1.3.3
func (ws *WebSocket) SetHTTPAuth(provider AuthProvider)
SetHTTPAuth will set the HTTP authentication provider to this one
func (*WebSocket) SetHandshakeTimeout ¶ added in v1.3.3
func (*WebSocket) SetPingInterval ¶
SetPingInterval sets how often the websocket will ping the server.
func (*WebSocket) SetReadBufferSize ¶ added in v1.3.3
func (*WebSocket) SetReadingWait ¶
SetReadingWait sets how long the reading will wait
func (*WebSocket) SetTLSConfig ¶
SetReadingWait sets how long the reading will wait
func (*WebSocket) SetTimeout ¶
SetTimeout will set the dialing timeout
func (*WebSocket) SetWriteBufferResizing ¶ added in v1.3.3
func (*WebSocket) SetWriteBufferSize ¶ added in v1.3.3
func (*WebSocket) SetWritingWait ¶
SetWritingWait sets how long the wait is for waiting