tcpraw

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

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 17 Imported by: 0

README

tcpraw

GoDoc Build Status Go Report Card Coverage Statusd MIT licensed

Introduction

A packet-oriented connection by simulating TCP protocol with some improvements.

Features

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

Benchmark

xtaci

goos: linux
goarch: amd64
pkg: github.com/xtaci/tcpraw
BenchmarkEcho-4            15074             79522 ns/op          12.88 MB/s        6114 B/op         56 allocs/op
PASS

Musixal

goos: linux
goarch: amd64
pkg: github.com/Musixal/tcpraw
BenchmarkEcho-4            25237             48274 ns/op          21.21 MB/s        2493 B/op         10 allocs/op
PASS

Status

Stable

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IPTablesReset

func IPTablesReset()

Types

type TCPConn

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

TCPConn, a wrapper for tcpconn for gc purpose

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) (int, net.Addr, error)

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