bufconn

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package bufconn offers access to connections with buffer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadData

func ReadData(r *bufio.Reader) ([]byte, error)

ReadData is non-blocking.

func ReceiveData

func ReceiveData(r *bufio.Reader) ([]byte, error)

ReceiveData is blocking.

Types

type Conn

type Conn struct {
	net.Conn
	R *bufio.Reader
}

Conn is a connection with bufio reader.

func Dial

func Dial(network, address string, timeout time.Duration) (*Conn, error)

Dial dials the address with timeout.

func DialURL

func DialURL(u *url.URL, d time.Duration) (*Conn, error)

DialURL dials the URL with timeout.

func NewConn

func NewConn(c net.Conn) *Conn

NewConn packs a `net.Conn` into a new `Conn`.

func (*Conn) ReadData

func (c *Conn) ReadData() ([]byte, error)

ReadData is non-blocking.

func (*Conn) ReceiveData

func (c *Conn) ReceiveData() ([]byte, error)

ReceiveData is blocking.

func (*Conn) SplitWrite added in v0.1.7

func (c *Conn) SplitWrite(b []byte, x int) (n int, err error)

SplitWrite is to break length pattern.

type ConnSolver

type ConnSolver interface {
	Bond(m, h, p string, b []byte) error
	GetConn() *Conn
}

ConnSolver is the interface of Conn to solve the connection prerequisites to transfer the real data. CONNECT to proxy. Maybe BIDN, UDP.

type HTTPConn added in v0.1.7

type HTTPConn Conn

HTTPConn represents a HTTP connection.

func DialHTTP added in v0.1.7

func DialHTTP(u *url.URL, d time.Duration) (*HTTPConn, error)

DialHTTP dials a HTTP URL with timeout.

func (*HTTPConn) Bond added in v0.1.7

func (c *HTTPConn) Bond(m, h, p string, b []byte) (err error)

Bond bonds a HTTP connection with the server.

func (*HTTPConn) GetConn added in v0.1.7

func (c *HTTPConn) GetConn() *Conn

GetConn returns the packed `*Conn` from a `*HTTPConn`.

type Socks4aConn

type Socks4aConn Conn

Socks4aConn represents a socks4a connection.

func DialSocks4a

func DialSocks4a(u *url.URL, d time.Duration) (*Socks4aConn, error)

DialSocks4a dials a socks4a URL with timeout.

func (*Socks4aConn) Bond

func (c *Socks4aConn) Bond(m, h, p string, b []byte) (err error)

Bond bonds a socks4a connection with the server.

func (*Socks4aConn) GetConn

func (c *Socks4aConn) GetConn() *Conn

GetConn returns the packed `*Conn` from a `*Socks4aConn`.

type Socks5Conn

type Socks5Conn Conn

Socks5Conn represents a socks5 connection.

func DialSocks5

func DialSocks5(u *url.URL, d time.Duration) (*Socks5Conn, error)

DialSocks5 dials a socks5 URL with timeout.

func (*Socks5Conn) Bond

func (c *Socks5Conn) Bond(m, h, p string, b []byte) (err error)

Bond bonds a socks5 connection with the server.

func (*Socks5Conn) GetConn

func (c *Socks5Conn) GetConn() *Conn

GetConn returns the packed `*Conn` from a `*Socks5Conn`.

Jump to

Keyboard shortcuts

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