Documentation ¶
Index ¶
- Variables
- func RecvProcSpec[T any](ctx *ProcRunCtx) (*T, error)
- func SendProcSpec(ctx *ProcRunCtx, spec any)
- type ExampleProcClient
- type ExampleProcServer
- type ExampleSpec
- type ExecInfo
- type ExecInfoKind
- type ExecProcClient
- type ExecProcServer
- type ExecSpec
- type ForwardSpec
- type GetProcClient
- type GetProcServer
- type GetPutSpec
- type LocalPFProcClient
- type LocalPFProcServer
- type Loop
- type LoopImpl
- func (loop *LoopImpl) Done() <-chan struct{}
- func (loop *LoopImpl) Remove(procID uint32) bool
- func (loop *LoopImpl) Run()
- func (loop *LoopImpl) Start(p Proc) (procID uint32, doneCh <-chan struct{})
- func (loop *LoopImpl) StartLater(proc Proc) (procID uint32, handle func(bool) <-chan struct{})
- func (loop *LoopImpl) Stop()
- type MainProcClient
- type MainProcMsg
- type MainProcMsgKind
- type MainProcMsg_Remove
- type MainProcMsg_Start
- type MainProcServer
- type MainSpec
- type MedSocksConn
- func (conn *MedSocksConn) Close() error
- func (conn *MedSocksConn) LocalAddr() net.Addr
- func (conn *MedSocksConn) Read(b []byte) (n int, err error)
- func (conn *MedSocksConn) RemoteAddr() net.Addr
- func (conn *MedSocksConn) SetDeadline(t time.Time) error
- func (conn *MedSocksConn) SetReadDeadline(t time.Time) error
- func (conn *MedSocksConn) SetWriteDeadline(t time.Time) error
- func (conn *MedSocksConn) Write(b []byte) (n int, err error)
- type MedSocksListener
- type Proc
- type ProcInfo
- type ProcKind
- type ProcRunCtx
- type ProcSide
- type PutProcClient
- type PutProcServer
- type RemotePFProcClient
- type RemotePFProcServer
- type SelfProcClient
- type SelfProcServer
- type SelfSpec
- type SocksProcClient
- type SocksProcServer
- type SocksSpec
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrLoopClosed = fmt.Errorf("loop closed")
)
Functions ¶
func RecvProcSpec ¶
func RecvProcSpec[T any](ctx *ProcRunCtx) (*T, error)
func SendProcSpec ¶
func SendProcSpec(ctx *ProcRunCtx, spec any)
Types ¶
type ExampleProcClient ¶
type ExampleProcClient struct { ProcInfo // contains filtered or unexported fields }
func NewExampleProcClient ¶
func NewExampleProcClient(spec ExampleSpec) *ExampleProcClient
func (*ExampleProcClient) Run ¶
func (p *ExampleProcClient) Run(ctx *ProcRunCtx)
type ExampleProcServer ¶
type ExampleProcServer struct {
ProcInfo
}
func NewExampleProcServer ¶
func NewExampleProcServer() *ExampleProcServer
func (*ExampleProcServer) Run ¶
func (p *ExampleProcServer) Run(ctx *ProcRunCtx)
type ExampleSpec ¶
type ExampleSpec struct {
Name string
}
type ExecInfo ¶
type ExecInfo struct { Kind ExecInfoKind Data []byte }
type ExecProcClient ¶
func NewExecProcClient ¶
func NewExecProcClient(spec ExecSpec) *ExecProcClient
func (*ExecProcClient) Run ¶
func (p *ExecProcClient) Run(ctx *ProcRunCtx)
type ExecProcServer ¶
type ExecProcServer struct {
ProcInfo
}
func NewExecProcServer ¶
func NewExecProcServer() *ExecProcServer
func (*ExecProcServer) Run ¶
func (p *ExecProcServer) Run(ctx *ProcRunCtx)
type ForwardSpec ¶
type GetProcClient ¶
type GetProcClient struct { ProcInfo // contains filtered or unexported fields }
func NewGetProcClient ¶
func NewGetProcClient(spec GetPutSpec) *GetProcClient
func (*GetProcClient) Run ¶
func (p *GetProcClient) Run(ctx *ProcRunCtx)
type GetProcServer ¶
type GetProcServer struct {
ProcInfo
}
func NewGetProcServer ¶
func NewGetProcServer() *GetProcServer
func (*GetProcServer) Run ¶
func (p *GetProcServer) Run(ctx *ProcRunCtx)
type GetPutSpec ¶
type LocalPFProcClient ¶
type LocalPFProcClient struct { ProcInfo // contains filtered or unexported fields }
func NewLocalPFProcClient ¶
func NewLocalPFProcClient(spec ForwardSpec) *LocalPFProcClient
func (*LocalPFProcClient) Run ¶
func (p *LocalPFProcClient) Run(ctx *ProcRunCtx)
type LocalPFProcServer ¶
type LocalPFProcServer struct {
ProcInfo
}
func NewLocalPFProcServer ¶
func NewLocalPFProcServer() *LocalPFProcServer
func (*LocalPFProcServer) Run ¶
func (p *LocalPFProcServer) Run(ctx *ProcRunCtx)
type Loop ¶
type Loop interface { Run() // Run the loop Start(h Proc) (procID uint32, doneCh <-chan struct{}) // Start a Proc StartLater(p Proc) ( procID uint32, handle func(bool) (doneCh <-chan struct{}), ) // Start a Proc later Remove(id uint32) bool // Remove a Proc Done() <-chan struct{} // Get the done chan of loop ctx Stop() // Stop the loop }
type LoopImpl ¶
type LoopImpl struct {
// contains filtered or unexported fields
}
func (*LoopImpl) StartLater ¶
type MainProcClient ¶
func NewMainProcClient ¶
func NewMainProcClient(spec MainSpec) *MainProcClient
func (*MainProcClient) Run ¶
func (p *MainProcClient) Run(ctx *ProcRunCtx)
func (*MainProcClient) StartProc ¶
func (p *MainProcClient) StartProc(kind ProcKind, spec any)
type MainProcMsg ¶
type MainProcMsg struct { Kind MainProcMsgKind SeqNo uint32 Data []byte }
type MainProcMsgKind ¶
type MainProcMsgKind string
const ( MainProcMsgKind_Start MainProcMsgKind = "Start" MainProcMsgKind_Remove MainProcMsgKind = "Remove" MainProcMsgKind_Exit MainProcMsgKind = "Exit" )
type MainProcMsg_Remove ¶
type MainProcMsg_Start ¶
type MainProcServer ¶
type MainProcServer struct {
ProcInfo
}
func NewMainProcServer ¶
func NewMainProcServer() *MainProcServer
func (*MainProcServer) Run ¶
func (p *MainProcServer) Run(ctx *ProcRunCtx)
type MedSocksConn ¶
type MedSocksConn struct {
// contains filtered or unexported fields
}
func (*MedSocksConn) Close ¶
func (conn *MedSocksConn) Close() error
func (*MedSocksConn) LocalAddr ¶
func (conn *MedSocksConn) LocalAddr() net.Addr
func (*MedSocksConn) RemoteAddr ¶
func (conn *MedSocksConn) RemoteAddr() net.Addr
func (*MedSocksConn) SetDeadline ¶
func (conn *MedSocksConn) SetDeadline(t time.Time) error
func (*MedSocksConn) SetReadDeadline ¶
func (conn *MedSocksConn) SetReadDeadline(t time.Time) error
func (*MedSocksConn) SetWriteDeadline ¶
func (conn *MedSocksConn) SetWriteDeadline(t time.Time) error
type MedSocksListener ¶
type MedSocksListener struct {
// contains filtered or unexported fields
}
MedSocksListener provides net.Listener interface for socks5.Serve
func NewMedSocksListener ¶
func NewMedSocksListener( ctx context.Context, dataIn pfDataInFn, dataOut pfDataOutFn) *MedSocksListener
func (*MedSocksListener) Addr ¶
func (l *MedSocksListener) Addr() net.Addr
func (*MedSocksListener) Close ¶
func (l *MedSocksListener) Close() error
func (*MedSocksListener) Wait ¶
func (l *MedSocksListener) Wait()
type Proc ¶
type Proc interface { Run(ctx *ProcRunCtx) Kind() ProcKind Side() ProcSide }
func CreateProcServer ¶
type ProcInfo ¶
type ProcInfo struct {
// contains filtered or unexported fields
}
func NewProcInfo ¶
type ProcKind ¶
type ProcKind string
const ( ProcKind_None ProcKind = "none" ProcKind_Example ProcKind = "example" ProcKind_Main ProcKind = "main" ProcKind_Exec ProcKind = "exec" ProcKind_Get ProcKind = "get" ProcKind_Put ProcKind = "put" ProcKind_FTP ProcKind = "ftp" // TODO ProcKind_LocalPF ProcKind = "forward-local" ProcKind_RemotePF ProcKind = "forward-remote" ProcKind_Socks ProcKind = "socks" ProcKind_Proxy ProcKind = "proxy" // TODO ProcKind_Self ProcKind = "self" ProcKind_WebUI ProcKind = "webui" // TODO ProcKind_CLI ProcKind = "cli" // TODO ProcKind_TMUX ProcKind = "tmux" // TODO )
type ProcRunCtx ¶
type ProcRunCtx struct { context.Context // proc ctx Cancel context.CancelFunc // cancel proc ctx Loop Loop // the loop running proc ProcID uint32 PktOutCh chan<- *pb.Packet // packet output channel PktOutDone <-chan struct{} PktInCh <-chan *pb.Packet // packet input channel }
func (*ProcRunCtx) InputPacket ¶
func (ctx *ProcRunCtx) InputPacket() *pb.Packet
func (*ProcRunCtx) InputPacketWithDone ¶
func (ctx *ProcRunCtx) InputPacketWithDone(doneCh <-chan struct{}) *pb.Packet
func (*ProcRunCtx) OutputPacket ¶
func (ctx *ProcRunCtx) OutputPacket(pkt *pb.Packet) bool
type PutProcClient ¶
type PutProcClient struct { ProcInfo // contains filtered or unexported fields }
func NewPutProcClient ¶
func NewPutProcClient(spec GetPutSpec) *PutProcClient
func (*PutProcClient) Run ¶
func (p *PutProcClient) Run(ctx *ProcRunCtx)
type PutProcServer ¶
type PutProcServer struct {
ProcInfo
}
func NewPutProcServer ¶
func NewPutProcServer() *PutProcServer
func (*PutProcServer) Run ¶
func (p *PutProcServer) Run(ctx *ProcRunCtx)
type RemotePFProcClient ¶
type RemotePFProcClient struct { ProcInfo // contains filtered or unexported fields }
func NewRemotePFProcClient ¶
func NewRemotePFProcClient(spec ForwardSpec) *RemotePFProcClient
func (*RemotePFProcClient) Run ¶
func (p *RemotePFProcClient) Run(ctx *ProcRunCtx)
type RemotePFProcServer ¶
type RemotePFProcServer struct {
ProcInfo
}
func NewRemotePFProcServer ¶
func NewRemotePFProcServer() *RemotePFProcServer
func (*RemotePFProcServer) Run ¶
func (p *RemotePFProcServer) Run(ctx *ProcRunCtx)
type SelfProcClient ¶
type SelfProcClient struct { ProcInfo // contains filtered or unexported fields }
func NewSelfProcClient ¶
func NewSelfProcClient(spec SelfSpec) *SelfProcClient
func (*SelfProcClient) Run ¶
func (p *SelfProcClient) Run(ctx *ProcRunCtx)
type SelfProcServer ¶
type SelfProcServer struct {
ProcInfo
}
func NewSelfProcServer ¶
func NewSelfProcServer() *SelfProcServer
func (*SelfProcServer) Run ¶
func (p *SelfProcServer) Run(ctx *ProcRunCtx)
type SocksProcClient ¶
type SocksProcClient struct { ProcInfo // contains filtered or unexported fields }
func NewSocksProcClient ¶
func NewSocksProcClient(spec SocksSpec) *SocksProcClient
func (*SocksProcClient) Run ¶
func (p *SocksProcClient) Run(ctx *ProcRunCtx)
type SocksProcServer ¶
type SocksProcServer struct {
ProcInfo
}
func NewSocksProcServer ¶
func NewSocksProcServer() *SocksProcServer
func (*SocksProcServer) Run ¶
func (p *SocksProcServer) Run(ctx *ProcRunCtx)
Click to show internal directories.
Click to hide internal directories.