wlnet

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const MAGIC uint8 = 42

MAGIC is the Wireleap magic number.

Variables

PROTO_VERSION is the current protocol version string according to semver v2.0.0: https://semver.org/spec/v2.0.0.html

View Source
var PROTO_VERSION_STRING = "<unset>"

Functions

func Splice

func Splice(src, dst io.ReadWriteCloser, maxtime time.Duration, bufsize int) (err error)

splice(src, dst, maxtime, bufsize) splices src and dst together end-to-end by performing a retransmit() in both directions with buffer size bufsize. If maxtime is not zero, connections are limited to this time-to-live.

func VersionCheck

func VersionCheck(v2 *semver.Version) error

versionCheck checks if the given version is parsable and compatible with the current protocol version (PROTO_VERSION). The current implementation checks if the major versions are different as that is the definition of backwards incompatibility in semver v2.0.0.

func WriteStatus

func WriteStatus(w io.Writer, s *status.T) error

WriteStatus(w, err) serializes the error err to the io.Writer w.

Types

type FragReadConn

type FragReadConn struct {
	net.Conn

	Errf func(error)
	// contains filtered or unexported fields
}

FragReadConn is the type of a connection reading from a network stream of wireleap-relay-fragmented data transparently.

func (*FragReadConn) Read

func (c *FragReadConn) Read(p []byte) (int, error)

Read overrides the Read method of a net.Conn wrapped by a FragReadConn.

type FragWriteCloser

type FragWriteCloser struct{ io.ReadWriteCloser }

FragWriteCloser is the type of a connection writing data to a network stream of wireleap-relay-fragmented data transparently.

func (FragWriteCloser) Write

func (c FragWriteCloser) Write(p []byte) (int, error)

Write overrides the Write method of a net.Conn wrapped by FragWriteCloser.

type Init

type Init struct {
	Command  string          `json:"command"`
	Protocol string          `json:"protocol"`
	Remote   *texturl.URL    `json:"remote"`
	Token    *sharetoken.T   `json:"token"`
	Version  *semver.Version `json:"version"`
}

Init is the struct type encoding values passed while initializing the tunneled connection ("init payload").

func ReadInit

func ReadInit(r io.Reader) (*Init, error)

ReadInit reads an init payload from a provided io.Reader.

func (*Init) WriteTo

func (i *Init) WriteTo(w io.Writer) error

WriteTo serializes the init payload to some io.Writer.

Directories

Path Synopsis
Package h2conn implements a net.Conn reads and writes over which are actually directed towards a h/2 stream.
Package h2conn implements a net.Conn reads and writes over which are actually directed towards a h/2 stream.
Package h2rwc implements a io.ReadWriteCloser composed from an io.Writer and io.ReadCloser (most probably, http.ResponseWriter and server-side http.Request.Body).
Package h2rwc implements a io.ReadWriteCloser composed from an io.Writer and io.ReadCloser (most probably, http.ResponseWriter and server-side http.Request.Body).

Jump to

Keyboard shortcuts

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