lib

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnFd

func ConnFd(conn syscall.Conn) (connFd int, err error)

func CopyDuplex

func CopyDuplex(c0, c1 net.Conn)

Types

type Client

type Client struct {
	Debug    bool             `long:"debug"`
	TLS      ClientTLS        `group:"tls" namespace:"tls"`
	NetNs    NetworkNamespace `group:"netns" namespace:"netns"`
	Addr     string           `long:"addr" description:"connect to address"`
	SourceIP string           `long:"source-ip" description:"IP used as source address"`

	Ctx context.Context
}

func (*Client) Conn

func (c *Client) Conn() (net.Conn, error)

func (*Client) Dial

func (c *Client) Dial(from net.Conn)

func (*Client) Fd

func (c *Client) Fd() (int, error)

func (*Client) File

func (c *Client) File() (*os.File, error)

func (*Client) IsFd

func (c *Client) IsFd() bool

type ClientTLS

type ClientTLS struct {
	CAFiles  []string `long:"ca-file" description:"TLS CA file"`
	CertFile string   `long:"cert-file" description:"TLS Cert file"`
	KeyFile  string   `long:"key-file" description:"TLS Key file"`
	Debug    bool     `long:"debug"`
	// contains filtered or unexported fields
}

func (*ClientTLS) TLSConfig

func (c *ClientTLS) TLSConfig() error

type Cloneflags

type Cloneflags struct {
	AllowPTRACE        bool
	ClearTID           bool
	CloneTID           bool
	DisablePTRACE      bool
	JoinCGroup         bool
	ParentPidfd        bool
	ParentTID          bool
	PrivateCGroup      bool
	PrivateClock       bool
	PrivateIO          bool
	PrivateIPC         bool
	PrivateMounts      bool
	PrivateNetwork     bool
	PrivatePID         bool
	PrivateUsers       bool
	PrivateUTS         bool
	PrivateTLS         bool
	ProtectSignals     bool
	ResetSignals       bool
	SetVFORK           bool
	SetPPID            bool
	SetThread          bool
	SetSystemV         bool
	ShareFSInfo        bool
	ShareFiles         bool
	ShareVirtualMemory bool

	SysProcAttr *syscall.SysProcAttr

	Errors []error
	// contains filtered or unexported fields
}

func NewCloneflags

func NewCloneflags() (*Cloneflags, error)

func (*Cloneflags) Set

func (c *Cloneflags) Set() *syscall.SysProcAttr

type KernelVersion

type KernelVersion struct {
	Major int
	Minor int
	Dot   int
}

func NewKernelVersion

func NewKernelVersion() (*KernelVersion, error)

func (*KernelVersion) Ok

func (k *KernelVersion) Ok(version KernelVersion) bool

type Listen

type Listen struct {
	Debug bool             `long:"debug"`
	TLS   ListenTLS        `group:"tls" namespace:"tls"`
	NetNs NetworkNamespace `group:"netns" namespace:"netns"`
	Addr  string           `long:"addr" description:"listen on address"`
	User  string           `long:"user" description:"change to user on listen thread"`
	Group string           `long:"group" description:"change to group on listen thread"`
	UID   int              `long:"uid" description:"change user on listen thread"`
	GID   int              `long:"gid" description:"change group on listen thread"`
	Fork  bool             `long:"fork" description:"fork listen process"`

	Ctx context.Context
	// contains filtered or unexported fields
}

func (*Listen) Listen

func (l *Listen) Listen(client *Client) (err error)

func (*Listen) SetClient

func (l *Listen) SetClient(client *Client)

type ListenTLS

type ListenTLS struct {
	*ClientTLS

	AllowedDNSNames []string `long:"allowed-dns-name" description:"Allowed DNS names"`
}

func (*ListenTLS) TLSConfig

func (l *ListenTLS) TLSConfig() error

type NetworkNamespace

type NetworkNamespace struct {
	DockerName  string `long:"docker-name" description:"A docker identifier"`
	NetName     string `long:"net-name" description:"A iproute2 netns name"`
	Path        string `long:"path" description:"A netns path"`
	SystemdUnit string `long:"systemd-unit" description:"A systemd unit name"`
	PID         int    `long:"pid" description:"Process ID of a running process"`
	TID         int    `long:"tid" description:"Thread ID of a running thread inside a process"`

	Ctx context.Context

	Debug bool `long:"debug"`
	// contains filtered or unexported fields
}

func (*NetworkNamespace) ChangeEveryThread

func (n *NetworkNamespace) ChangeEveryThread() error

func (*NetworkNamespace) Close

func (n *NetworkNamespace) Close()

func (*NetworkNamespace) Dialer

func (n *NetworkNamespace) Dialer(sourceIP string) *net.Dialer

func (*NetworkNamespace) Enter

func (n *NetworkNamespace) Enter() (err error, ok bool)

func (*NetworkNamespace) Exit

func (n *NetworkNamespace) Exit() (err error)

type Pipe

type Pipe struct {
	Fds   [2]int
	Files [2]*os.File
}

func (*Pipe) Unixpair

func (p *Pipe) Unixpair() (conn [2]net.Conn, err error)

type Proc

type Proc struct {
	Ctx    context.Context
	Chroot string

	Cloneflags *Cloneflags
	Uid        int
	Gid        int
}

func (*Proc) ForkListener

func (p *Proc) ForkListener(l net.Listener) error

func (*Proc) ForkListenerPipe

func (p *Proc) ForkListenerPipe(l1 net.Listener, dial func(net.Conn)) error

Jump to

Keyboard shortcuts

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