utils

package
v1.4.4-beta.7 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(src string, dst string, filter func(os.FileInfo) bool) error

func CopyFile

func CopyFile(src, dst string) error

Types

type Environment

type Environment interface {
	IsTest() bool
	IsDev() bool
	IsDebugRace() bool
	IsDiagnostics() bool
	DevServerURL() string
	GetExecutableFolder() string
}

func DetectEnvironment

func DetectEnvironment() Environment

type Forwarder

type Forwarder interface {
	Close()
	OnConnect(func(addr string))
	OnDisconnect(func(addr string))
}

func ForwardTCP

func ForwardTCP(source string, dest string) (Forwarder, error)

func ForwardUDP

func ForwardUDP(source string, dest string) (Forwarder, error)

type MutexBuilder

type MutexBuilder func() RWLocker

type OutputBuffer

type OutputBuffer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*OutputBuffer) Close

func (b *OutputBuffer) Close() error

func (*OutputBuffer) SetPTY

func (b *OutputBuffer) SetPTY(pty *os.File)

func (*OutputBuffer) UnsetPTY

func (b *OutputBuffer) UnsetPTY()

func (*OutputBuffer) Write

func (b *OutputBuffer) Write(d []byte) (n int, err error)

type OutputBufferSeeker

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

func NewOutputBufferSeeker

func NewOutputBufferSeeker(buf *OutputBuffer, canResize func() bool, closer func()) *OutputBufferSeeker

func (*OutputBufferSeeker) Close

func (s *OutputBufferSeeker) Close() error

func (*OutputBufferSeeker) Read

func (s *OutputBufferSeeker) Read(dst []byte) (n int, err error)

func (*OutputBufferSeeker) Resize

func (s *OutputBufferSeeker) Resize(size TTYSize)

func (*OutputBufferSeeker) Seek

func (s *OutputBufferSeeker) Seek(offset int64, whence int) (int64, error)

type RWLocker

type RWLocker interface {
	Lock()
	Unlock()
	RLock()
	RUnlock()
}

func GetMutex

func GetMutex(environment Environment) RWLocker

type TTY

type TTY interface {
	io.ReadSeekCloser
	Resize(size TTYSize)
}

type TTYOutput

type TTYOutput interface {
	Write(d []byte) (n int, err error)
	GetReadSeeker() TTY
}

func NewTTYOutput

func NewTTYOutput() TTYOutput

type TTYSize

type TTYSize struct {
	Cols uint16 `json:"cols"`
	Rows uint16 `json:"rows"`
	X    uint16 `json:"x"`
	Y    uint16 `json:"y"`
}

type ThreadSafeSlice

type ThreadSafeSlice struct {
	sync.Mutex
	Elements []interface{}
}

func (*ThreadSafeSlice) Find

func (slice *ThreadSafeSlice) Find(elem interface{}) interface{}

func (*ThreadSafeSlice) Push

func (slice *ThreadSafeSlice) Push(elem interface{})

func (*ThreadSafeSlice) Remove

func (slice *ThreadSafeSlice) Remove(elem interface{})

func (*ThreadSafeSlice) ToSlice

func (slice *ThreadSafeSlice) ToSlice() []interface{}

Jump to

Keyboard shortcuts

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