tcpraw

package module
v1.2.25 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: MIT Imports: 14 Imported by: 0

README

tcpraw

GoDoc Build Status Go Report Card Coverage Statusd MIT licensed

Introduction

A packet-oriented connection by simulating TCP protocol

Features

  1. Tiny
  2. Support IPv4 and IPv6.
  3. Realistic sliding window, NAT friendly.
  4. Pure golang without cgo, available on all architecture.

Documentation

For complete documentation, see the associated Godoc.

Benchmark

goos: linux
goarch: amd64
pkg: github.com/xtaci/tcpraw
BenchmarkEcho-2   	   20000	     93036 ns/op	  11.01 MB/s	    6200 B/op	      62 allocs/op
PASS
ok  	github.com/xtaci/tcpraw	2.758s

Status

Stable

Who is using this

https://github.com/xtaci/kcptun

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TCPConn

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

TCPConn defines a TCP-packet oriented connection

func Dial

func Dial(network, address string) (*TCPConn, error)

Dial connects to the remote TCP port, and returns a single packet-oriented connection

func Listen

func Listen(network, address string) (*TCPConn, error)

Listen acts like net.ListenTCP, and returns a single packet-oriented connection

func (*TCPConn) Close

func (conn *TCPConn) Close() error

Close closes the connection.

func (*TCPConn) LocalAddr

func (conn *TCPConn) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (*TCPConn) ReadFrom

func (conn *TCPConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

ReadFrom implements the PacketConn ReadFrom method.

func (*TCPConn) SetDSCP

func (conn *TCPConn) SetDSCP(dscp int) error

SetDSCP sets the 6bit DSCP field in IPv4 header, or 8bit Traffic Class in IPv6 header.

func (*TCPConn) SetDeadline

func (conn *TCPConn) SetDeadline(t time.Time) error

SetDeadline implements the Conn SetDeadline method.

func (*TCPConn) SetReadBuffer

func (conn *TCPConn) SetReadBuffer(bytes int) error

SetReadBuffer sets the size of the operating system's receive buffer associated with the connection.

func (*TCPConn) SetReadDeadline

func (conn *TCPConn) SetReadDeadline(t time.Time) error

SetReadDeadline implements the Conn SetReadDeadline method.

func (*TCPConn) SetWriteBuffer

func (conn *TCPConn) SetWriteBuffer(bytes int) error

SetWriteBuffer sets the size of the operating system's transmit buffer associated with the connection.

func (*TCPConn) SetWriteDeadline

func (conn *TCPConn) SetWriteDeadline(t time.Time) error

SetWriteDeadline implements the Conn SetWriteDeadline method.

func (*TCPConn) WriteTo

func (conn *TCPConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

WriteTo implements the PacketConn WriteTo method.

Jump to

Keyboard shortcuts

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