utils

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SSH   = "ssh"
	RDP   = "rdp"
	VNC   = "vnc"
	HTTP  = "http"
	HTTPS = "https"
)
View Source
const (
	InterruptMessage = "command interrupted, exiting"
)

Variables

View Source
var PortSchemesMap = []PortScheme{
	{
		Port:   22,
		Scheme: SSH,
	},
	{
		Port:   3389,
		Scheme: RDP,
	},
	{
		Port:   5900,
		Scheme: VNC,
	},
	{
		Port:   80,
		Scheme: HTTP,
	},
	{
		Port:   443,
		Scheme: HTTPS,
	},
}

Functions

func CalcTerminalColumnsCount added in v0.0.5

func CalcTerminalColumnsCount() int

func ExtractBasicAuthLoginAndPassFromRequest added in v0.2.7

func ExtractBasicAuthLoginAndPassFromRequest(r *http.Request) (login, pass string, err error)

func ExtractPortAndHost added in v0.0.14

func ExtractPortAndHost(input string) (port int, host string)

func GetPortByScheme added in v0.0.14

func GetPortByScheme(scheme string) int

func GetSchemeByPort added in v0.0.14

func GetSchemeByPort(port int) string

func ReadPassword added in v0.0.4

func ReadPassword() ([]byte, error)

func RemovePortFromURL

func RemovePortFromURL(rawURL string) string

func RunSSH added in v0.1.2

func RunSSH(args []string) error

Types

type Auth added in v0.0.6

type Auth interface {
	AuthRequest(r *http.Request) error
}

type BaseClient added in v0.0.6

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

func (*BaseClient) Call added in v0.0.6

func (c *BaseClient) Call(req *http.Request, target interface{}, errTarget error) (resp *http.Response, err error)

func (*BaseClient) WithAuth added in v0.0.6

func (c *BaseClient) WithAuth(a Auth)

type BearerAuth added in v0.0.10

type BearerAuth struct {
	TokenProvider func() (string, error)
}

func (*BearerAuth) AuthRequest added in v0.0.10

func (ba *BearerAuth) AuthRequest(req *http.Request) error

type FallbackAuth added in v0.0.10

type FallbackAuth struct {
	PrimaryAuth  Auth
	FallbackAuth Auth
}

func (*FallbackAuth) AuthRequest added in v0.0.10

func (fa *FallbackAuth) AuthRequest(req *http.Request) error

type Output added in v0.0.6

type Output struct {
	Payload []byte
	Error   error
}

type PasswordScanner added in v0.0.6

type PasswordScanner func() ([]byte, error)

type PortScheme added in v0.0.14

type PortScheme struct {
	Port   int
	Scheme string
}

type PromptReader added in v0.0.6

type PromptReader struct {
	Sc              Scanner
	SigChan         chan os.Signal
	PasswordScanner PasswordScanner
}

func (*PromptReader) Output added in v0.0.10

func (pr *PromptReader) Output(text string)

func (*PromptReader) ReadPassword added in v0.0.6

func (pr *PromptReader) ReadPassword() (string, error)

func (*PromptReader) ReadString added in v0.0.6

func (pr *PromptReader) ReadString() (string, error)

type Scanner added in v0.0.6

type Scanner interface {
	Scan() bool
	Text() string
	Err() error
}

type StorageBasicAuth added in v0.0.6

type StorageBasicAuth struct {
	AuthProvider func() (login, pass string, err error)
}

func (*StorageBasicAuth) AuthRequest added in v0.0.6

func (sba *StorageBasicAuth) AuthRequest(req *http.Request) error

type WsClient added in v0.0.6

type WsClient struct {
	WsURLBuilder WsURLBuilder
	Conn         *websocket.Conn
}

func NewWsClient added in v0.0.6

func NewWsClient(ctx context.Context, wsURLBuilder WsURLBuilder) (wsc *WsClient, err error)

func (*WsClient) Close added in v0.0.6

func (wc *WsClient) Close() error

func (*WsClient) Read added in v0.0.6

func (wc *WsClient) Read() (msg []byte, err error)

func (*WsClient) Write added in v0.0.6

func (wc *WsClient) Write(inputMsg []byte) (n int, err error)

type WsURLBuilder added in v0.0.6

type WsURLBuilder func(ctx context.Context) (url string, err error)

Jump to

Keyboard shortcuts

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