ctrl

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeChecking = "application/plain"
	ContentTypeFull     = "application/octet-stream"
	ContentTypeHalf     = "application/x-binary"
)
View Source
const (
	ActionCreate    byte = 0x00
	ActionData      byte = 0x01
	ActionDelete    byte = 0x02
	ActionHeartbeat byte = 0x03
)

Variables

This section is empty.

Functions

func NewFullChunkedReadWriter

func NewFullChunkedReadWriter(id string, reqBody io.WriteCloser, serverResp io.ReadCloser) io.ReadWriter

NewFullChunkedReadWriter 全双工读写流

func NewHalfChunkedReadWriter

func NewHalfChunkedReadWriter(ctx context.Context, id string, client *http.Client, method, target string,
	serverResp io.ReadCloser, baseHeader http.Header, redirect string) io.ReadWriter

NewHalfChunkedReadWriter 半双工读写流, 用发送请求的方式模拟写

func RandString

func RandString(n int) string

func Run

func Run(ctx context.Context, config *Suo5Config) error

Types

type ClientConnectCloseEvent

type ClientConnectCloseEvent struct {
	Conn net.Conn
}

type ClientConnectionEvent

type ClientConnectionEvent struct {
	Conn net.Conn
}

type ClientEventHandler

type ClientEventHandler struct {
	Inner                   server.Handler
	OnNewClientConnection   func(event *ClientConnectionEvent)
	OnClientConnectionClose func(event *ClientConnectCloseEvent)
}

func (*ClientEventHandler) Handle

func (e *ClientEventHandler) Handle(conn net.Conn) error

type ConnectedEvent

type ConnectedEvent struct {
	Mode ConnectionType `json:"mode"`
}

type ConnectionType

type ConnectionType string
const (
	AutoDuplex ConnectionType = "auto"
	FullDuplex ConnectionType = "full"
	HalfDuplex ConnectionType = "half"
)

type RawWriter added in v0.5.0

type RawWriter interface {
	WriteRaw(p []byte) (n int, err error)
}

type Suo5Config

type Suo5Config struct {
	Method           string         `json:"method"`
	Listen           string         `json:"listen"`
	Target           string         `json:"target"`
	NoAuth           bool           `json:"no_auth"`
	Username         string         `json:"username"`
	Password         string         `json:"password"`
	Mode             ConnectionType `json:"mode"`
	BufferSize       int            `json:"buffer_size"`
	Timeout          int            `json:"timeout"`
	Debug            bool           `json:"debug"`
	UpstreamProxy    string         `json:"upstream_proxy"`
	RedirectURL      string         `json:"redirect_url"`
	RawHeader        []string       `json:"raw_header"`
	DisableHeartbeat bool           `json:"disable_heartbeat"`

	Header                  http.Header                          `json:"-"`
	TestExit                string                               `json:"-"`
	OnRemoteConnected       func(e *ConnectedEvent)              `json:"-"`
	OnNewClientConnection   func(event *ClientConnectionEvent)   `json:"-"`
	OnClientConnectionClose func(event *ClientConnectCloseEvent) `json:"-"`
	GuiLog                  io.Writer                            `json:"-"`
}

func DefaultSuo5Config

func DefaultSuo5Config() *Suo5Config

Jump to

Keyboard shortcuts

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