udt

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

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

Go to latest
Published: May 14, 2021 License: BSD-3-Clause Imports: 15 Imported by: 2

README

go-udtwrapper

This is a cgo wrapper around the main C++ UDT implementation.

Usage

Tools:

  • udtcat - netcat using the udt pkg

Try:

(cd udtcat; go build; ./test_simple.sh)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// UDP_RCVBUF_SIZE is the default UDP_RCVBUF size.
	UDP_RCVBUF_SIZE = uint32(20971520) // 20MB

	// UDT_SNDTIMEO is the udt_send() timeout in milliseconds
	// note this doesnt change the interface, we use it as a poor polling
	UDT_SNDTIMEO_MS = C.int(UDT_ASYNC_TIMEOUT)

	// UDT_RCVTIMEO is the udt_recv() timeout in milliseconds
	// note this doesnt change the interface, we use it as a poor polling
	UDT_RCVTIMEO_MS = C.int(UDT_ASYNC_TIMEOUT)

	// UDT_ASYNC_TIMEOUT (in ms)
	UDT_ASYNC_TIMEOUT = 40
)

Functions

func Dial

func Dial(network, address string) (c net.Conn, err error)

Dial connects to the remote address raddr on the network net, which must be "udt", "udt4", or "udt6". If laddr is not nil, it is used as the local address for the connection.

func Listen

func Listen(network, address string) (net.Listener, error)

Listen listens for incoming UDT packets addressed to the local address laddr. Net must be "udt", "udt4", or "udt6". If laddr has a port of 0, ListenUDT will choose an available port. The LocalAddr method of the returned UDTConn can be used to discover the port. The returned connection's ReadFrom and WriteTo methods can be used to receive and send UDT packets with per-packet addressing.

Types

type Dialer

type Dialer struct {
	LocalAddr net.Addr
}

func (*Dialer) Dial

func (d *Dialer) Dial(network, address string) (c net.Conn, err error)

Dial connects to the remote address raddr on the network net, which must be "udt", "udt4", or "udt6".

func (*Dialer) DialUDT

func (d *Dialer) DialUDT(network string, raddr *UDTAddr) (*UDTConn, error)

DialUDT connects to the remote address raddr on the network net, which must be "udt", "udt4", or "udt6".

type UDTAddr

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

func ResolveUDTAddr

func ResolveUDTAddr(n, addr string) (*UDTAddr, error)

func WrapUDPAddr

func WrapUDPAddr(ua *net.UDPAddr) *UDTAddr

func (*UDTAddr) AF

func (a *UDTAddr) AF() int

AF returns UDTAddr's AF (Address Family)

func (*UDTAddr) IPPROTO

func (a *UDTAddr) IPPROTO() int

IPPROTO returns UDTAddr's IPPROTO (IPPROTO_UDP)

func (*UDTAddr) Network

func (a *UDTAddr) Network() string

func (*UDTAddr) String

func (a *UDTAddr) String() string

type UDTConn

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

UDTConn is the implementation of the Conn and PacketConn interfaces for UDT network connections.

func DialUDT

func DialUDT(net string, laddr, raddr *UDTAddr) (*UDTConn, error)

DialUDT connects to the remote address raddr on the network net, which must be "udt", "udt4", or "udt6". If laddr is not nil, it is used as the local address for the connection.

func (UDTConn) Close

func (fd UDTConn) Close() error

func (UDTConn) LocalAddr

func (fd UDTConn) LocalAddr() net.Addr

func (UDTConn) Read

func (fd UDTConn) Read(buf []byte) (readcnt int, err error)

func (UDTConn) RemoteAddr

func (fd UDTConn) RemoteAddr() net.Addr

func (UDTConn) SetDeadline

func (fd UDTConn) SetDeadline(t time.Time) error

func (UDTConn) SetReadDeadline

func (fd UDTConn) SetReadDeadline(t time.Time) error

func (UDTConn) SetWriteDeadline

func (fd UDTConn) SetWriteDeadline(t time.Time) error

func (UDTConn) Write

func (fd UDTConn) Write(buf []byte) (writecnt int, err error)

type UDTListener

type UDTListener struct {
	net.Listener
	// contains filtered or unexported fields
}

UDTListener is a network listener for UDT.

func ListenUDT

func ListenUDT(network string, laddr *UDTAddr) (*UDTListener, error)

ListenUDT listens for incoming UDT packets addressed to the local address laddr. Net must be "udt", "udt4", or "udt6". If laddr has a port of 0, ListenUDT will choose an available port. The LocalAddr method of the returned UDTConn can be used to discover the port. The returned connection's ReadFrom and WriteTo methods can be used to receive and send UDT packets with per-packet addressing.

func (*UDTListener) Accept

func (l *UDTListener) Accept() (c net.Conn, err error)

func (*UDTListener) Addr

func (l *UDTListener) Addr() net.Addr

func (*UDTListener) Close

func (l *UDTListener) Close() error

Directories

Path Synopsis
Godeps
_workspace/src/github.com/jbenet/go-ctxgroup
package ctxgroup provides the ContextGroup, a hybrid between the context.Context and sync.WaitGroup, which models process trees.
package ctxgroup provides the ContextGroup, a hybrid between the context.Context and sync.WaitGroup, which models process trees.
_workspace/src/github.com/jbenet/go-sockaddr/net
package sockaddrnet provides conversions between net.Addr and syscall.Sockaddr
package sockaddrnet provides conversions between net.Addr and syscall.Sockaddr
_workspace/src/golang.org/x/net/context
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
package udtcat provides an implementation of netcat using the go-udtwrapper package.
package udtcat provides an implementation of netcat using the go-udtwrapper package.

Jump to

Keyboard shortcuts

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