ipc

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromCustomCfg

func FromCustomCfg(cfg Custom) (io.ReadWriteCloser, error)

FromCustomCfg is the counter part of ToCustomCfg(). Turns a win pipe handler pair back into an io.ReadWriteCloser

func Hijackify

func Hijackify(conn net.Conn, timeout time.Duration) (net.Conn, error)

Hijackify to be used in conjunction with HijackAcceptor. Tells the server to perform hijack operation on the connection which means the server will retrieve the underlying tcp connection and hand it over / no longer serves requests to it. -> we can use it as a long-running server-client connection and re-purpose it to run our IPC/yamux stack on top.

func NewClientIPC

func NewClientIPC(logger Logger, sockConn io.ReadWriteCloser, handler http.Handler, onServerClosed func(error), option ...Option) (io.Closer, *http.Client, error)

func NewHijackAcceptor

func NewHijackAcceptor(logger Logger, cb func(context.Context, io.ReadWriteCloser)) (string, http.Handler)

func NewServerIPC

func NewServerIPC(logger Logger, sockConn io.ReadWriteCloser, handler http.Handler, onServerClosed func(error), option ...Option) (io.Closer, *http.Client, error)

Types

type CloseWriter

type CloseWriter interface {
	CloseWrite() error
}

type Custom

type Custom struct {
	R uint64 `json:"r"`
	W uint64 `json:"w"`
}

func FakeTestCustom

func FakeTestCustom(fd int) Custom

type FdWrapper

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

func NewConnectionPair

func NewConnectionPair(cmd *exec.Cmd) (io.ReadWriteCloser, *FdWrapper, error)

func (*FdWrapper) Close

func (p *FdWrapper) Close() error

func (*FdWrapper) ToCustomCfg

func (p *FdWrapper) ToCustomCfg() Custom

type Logger

type Logger interface {
	Printf(format string, v ...any)
	Errorf(format string, v ...any)
}

type Option

type Option func(*cfg) *cfg

func WithShutdownTimeout

func WithShutdownTimeout(d time.Duration) Option

type PipeConn

type PipeConn struct {
	R *os.File
	W *os.File
}

PipeConn turns a pair of uni directional pipe handlers into a bidirectional io.ReadWriteCloser

func (*PipeConn) Close

func (p *PipeConn) Close() error

func (*PipeConn) Read

func (p *PipeConn) Read(b []byte) (int, error)

func (*PipeConn) Write

func (p *PipeConn) Write(b []byte) (int, error)

type PluginConfigFromEngine

type PluginConfigFromEngine struct {
	Name                string        `json:"name"`
	RegistrationTimeout time.Duration `json:"timeout"`
	Custom
}

func NewPluginConfigFromEngineEnv

func NewPluginConfigFromEngineEnv(in string) (*PluginConfigFromEngine, error)

func (*PluginConfigFromEngine) ToString

func (c *PluginConfigFromEngine) ToString() (string, error)

Jump to

Keyboard shortcuts

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