c

package module
v0.0.0-...-7447419 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: AGPL-3.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewListener

func NewListener(serialized_configuration []byte) (*Listener, *Error)

NewListener creates a new Sandwich listener.

func NewTunnelContext

func NewTunnelContext(lib *Lib, serialized_configuration []byte) (*TunnelContext, *Error)

NewTunnelContext creates a new TunnelContext.

Types

type Error

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

Error wraps a C pointer to an error.

func NewErrorFromPointer

func NewErrorFromPointer(e *C.struct_SandwichError) *Error

NewErrorFromPointer creates a new Error from a pointer.

func (*Error) GetCode

func (e *Error) GetCode() uint32

GetCode returns the code of error.

func (*Error) GetDetails

func (e *Error) GetDetails() *Error

GetDetails returns the encapsulated error, if any.

func (*Error) GetKind

func (e *Error) GetKind() uint32

GetKind returns the kind of error.

func (*Error) GetMsg

func (e *Error) GetMsg() string

GetMsg returns the error string, or "nil" if no error string is found with this error.

type IO

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

Io wraps a SandwichIO structure.

func NewIO

func NewIO(readWriter io.ReadWriter) *IO

NewIO creates a new IO structure.

type Lib

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

Lib wraps a C pointer to a top-level Sandwich context.

func NewLib

func NewLib() *Lib

NewLib creates a new Lib.

type Listener

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

Listener wraps a C pointer to a Sandwich listener object.

func (*Listener) Accept

func (listener *Listener) Accept() (*OwnedIO, uint32)

Accept prompts the Sandwich listener to start accepting connections.

func (*Listener) Close

func (listener *Listener) Close()

Close closes the listener to new connections.

func (*Listener) Listen

func (listener *Listener) Listen() uint32

Listen causes the Sandwich listener to start listening for connections.

type OwnedIO

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

OwnedIO wraps a C pointer to a Sandwich owned IO.

func NewOwnedIOTCPClient

func NewOwnedIOTCPClient(hostname string, port uint16) (*OwnedIO, uint32)

NewOwnedIOTCPClient creates a new client side Sandwich IO using TCP.

func NewOwnedIOTurboClient

func NewOwnedIOTurboClient(udp_hostname string, udp_port uint16, tcp_hostname string, tcp_port uint16) (*OwnedIO, uint32)

NewOwnedIOTurboClient creates a new client side Sandwich IO using Turbo transport.

func (*OwnedIO) Read

func (ownedIO *OwnedIO) Read(buf []byte) (int, uint32)

Read reads some data from the owned IO.

func (*OwnedIO) SetState

func (ownedIO *OwnedIO) SetState(tunnelState uint32)

Set the tunnelIO's state.

func (*OwnedIO) Write

func (ownedIO *OwnedIO) Write(buf []byte) (int, uint32)

Write writes some data to the owned IO.

type Tunnel

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

Tunnel wraps a C pointer to a Sandwich tunnel.

func (*Tunnel) AttachTracer

func (tunnel *Tunnel) AttachTracer(contextString string, fd int32)

AttachTracer attaches a tracer to the tunnel.

func (*Tunnel) GetState

func (tunnel *Tunnel) GetState() uint32

GetState returns the state of the tunnel.

func (*Tunnel) Handshake

func (tunnel *Tunnel) Handshake() (uint32, *Error)

Handshake performs or resumes the handshake stage.

func (*Tunnel) Read

func (tunnel *Tunnel) Read(buffer []byte) (int, uint32)

Read reads data from the tunnel.

func (*Tunnel) Write

func (tunnel *Tunnel) Write(buffer []byte) (int, uint32)

Write write data to the tunnel.

type TunnelContext

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

TunnelContext wraps a C pointer to a Sandwich tunnel context.

func (*TunnelContext) NewTunnel

func (tunnelContext *TunnelContext) NewTunnel(serialized_configuration []byte, tunnelIO TunnelIO) (*Tunnel, *Error)

NewTunnel creates a new tunnel using a Sandwich tunnel context.

type TunnelIO

type TunnelIO interface {
	// TunnelIOInterface is a io.ReadWriter
	io.ReadWriter

	// SetState sets the state of the tunnel.
	//
	// It is guaranteed that the state of the tunnel will not change between
	// two calls to SetState.
	SetState(tunnelState uint32)
}

TunnelIO wraps a Sandwich tunnel IO.

Jump to

Keyboard shortcuts

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