client

package
v0.13.3-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DeviceUIDHeader = "X-Device-UID"
)

Variables

View Source
var (
	ErrConnectionFailed = errors.New("connection failed")
	ErrNotFound         = errors.New("not found")
	ErrUnknown          = errors.New("unknown error")
)

Functions

func Dial added in v0.13.0

func Dial(url string, header http.Header) (*websocket.Conn, *http.Response, error)

Dial creates a websocket connection to ShellHub's SSH server.

It receivees the endpoint to connect and the necessary headers for authentication on the server. If the server redirect the connection with status http.StatusTemporaryRedirect or http.StatusPermanentRedirect, the Dial method will follow. Any other response from the server will result in an error as result of this function.

func SameDomainRedirectPolicy added in v0.13.0

func SameDomainRedirectPolicy() resty.RedirectPolicyFunc

SameDomainRedirectPolicy allows redirect only if the redirected domain is the same as original domain, e.g. redirect to "www.imroc.cc" from "imroc.cc" is allowed, but redirect to "google.com" is not allowed.

Types

type Client

type Client interface {
	// contains filtered or unexported methods
}

func NewClient

func NewClient(opts ...Opt) Client

type LeveledLogger added in v0.6.0

type LeveledLogger struct {
	Logger *logrus.Logger
}

func (*LeveledLogger) Debugf added in v0.9.0

func (l *LeveledLogger) Debugf(msg string, keysAndValues ...interface{})

func (*LeveledLogger) Errorf added in v0.9.0

func (l *LeveledLogger) Errorf(msg string, keysAndValues ...interface{})

func (*LeveledLogger) Warnf added in v0.9.0

func (l *LeveledLogger) Warnf(msg string, keysAndValues ...interface{})

type Opt

type Opt func(*client) error

func WithHost

func WithHost(host string) Opt

func WithLogger added in v0.4.0

func WithLogger(logger *logrus.Logger) Opt

func WithPort

func WithPort(port int) Opt

func WithScheme added in v0.3.2

func WithScheme(scheme string) Opt

func WithURL added in v0.3.2

func WithURL(u *url.URL) Opt

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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