common

package
v0.0.0-...-d0f1447 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2019 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientHttpConnection

type ClientHttpConnection struct {
	net.Conn
	Connection net.Conn
	Client     http.Client
	ServerUrl  string
	RandomGen  *rand.Rand
	Ch         chan []byte
	// contains filtered or unexported fields
}

func GetCilentHttpConnection

func GetCilentHttpConnection(proto, serverUrl string) (ClientHttpConnection, error)

func (ClientHttpConnection) Close

func (c ClientHttpConnection) Close() error

Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.

func (ClientHttpConnection) LocalAddr

func (c ClientHttpConnection) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (ClientHttpConnection) Read

func (c ClientHttpConnection) Read(b []byte) (n int, err error)

func (ClientHttpConnection) RemoteAddr

func (c ClientHttpConnection) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (ClientHttpConnection) SetDeadline

func (c ClientHttpConnection) SetDeadline(t time.Time) error

SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.

A deadline is an absolute time after which I/O operations fail with a timeout (see type Error) instead of blocking. The deadline applies to all future and pending I/O, not just the immediately following call to Read or Write. After a deadline has been exceeded, the connection can be refreshed by setting a deadline in the future.

An idle timeout can be implemented by repeatedly extending the deadline after successful Read or Write calls.

A zero value for t means I/O operations will not time out.

func (ClientHttpConnection) SetReadDeadline

func (c ClientHttpConnection) SetReadDeadline(t time.Time) error

SetReadDeadline sets the deadline for future Read calls and any currently-blocked Read call. A zero value for t means Read will not time out.

func (ClientHttpConnection) SetWriteDeadline

func (c ClientHttpConnection) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the deadline for future Write calls and any currently-blocked Write call. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means Write will not time out.

func (ClientHttpConnection) Write

func (c ClientHttpConnection) Write(b []byte) (n int, err error)

Write writes data to the connection. Write can be made to time out and return an Error with Timeout() == true after a fixed time limit; see SetDeadline and SetWriteDeadline.

type ClientHttpDialer

type ClientHttpDialer struct {
	proxy.Dialer
	Conn net.Conn
}

func (ClientHttpDialer) Dial

func (cl ClientHttpDialer) Dial(network, addr string) (c net.Conn, err error)

type ClientUdpConnection

type ClientUdpConnection struct {
	net.Conn
	Connection *net.UDPConn
	Buffer     []byte
	Reader     *bufio.Reader
}

func (ClientUdpConnection) Close

func (u ClientUdpConnection) Close() error

Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.

func (ClientUdpConnection) LocalAddr

func (u ClientUdpConnection) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (ClientUdpConnection) Read

func (u ClientUdpConnection) Read(b []byte) (n int, err error)

func (ClientUdpConnection) RemoteAddr

func (u ClientUdpConnection) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (ClientUdpConnection) SetDeadline

func (u ClientUdpConnection) SetDeadline(t time.Time) error

SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.

A deadline is an absolute time after which I/O operations fail with a timeout (see type Error) instead of blocking. The deadline applies to all future and pending I/O, not just the immediately following call to Read or Write. After a deadline has been exceeded, the connection can be refreshed by setting a deadline in the future.

An idle timeout can be implemented by repeatedly extending the deadline after successful Read or Write calls.

A zero value for t means I/O operations will not time out.

func (ClientUdpConnection) SetReadDeadline

func (u ClientUdpConnection) SetReadDeadline(t time.Time) error

SetReadDeadline sets the deadline for future Read calls and any currently-blocked Read call. A zero value for t means Read will not time out.

func (ClientUdpConnection) SetWriteDeadline

func (u ClientUdpConnection) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the deadline for future Write calls and any currently-blocked Write call. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means Write will not time out.

func (ClientUdpConnection) Write

func (u ClientUdpConnection) Write(b []byte) (n int, err error)

Write writes data to the connection. Write can be made to time out and return an Error with Timeout() == true after a fixed time limit; see SetDeadline and SetWriteDeadline.

type ServerHttpConnection

type ServerHttpConnection struct {
	net.Conn
	RCh      chan []byte
	WCh      chan []byte
	LastUsed time.Time
	Closed   bool
}

func GetServerHttpConnection

func GetServerHttpConnection() ServerHttpConnection

func (ServerHttpConnection) Close

func (c ServerHttpConnection) Close() error

Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.

func (ServerHttpConnection) LocalAddr

func (c ServerHttpConnection) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (ServerHttpConnection) Read

func (c ServerHttpConnection) Read(b []byte) (n int, err error)

func (ServerHttpConnection) RemoteAddr

func (c ServerHttpConnection) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (ServerHttpConnection) SetDeadline

func (c ServerHttpConnection) SetDeadline(t time.Time) error

SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.

A deadline is an absolute time after which I/O operations fail with a timeout (see type Error) instead of blocking. The deadline applies to all future and pending I/O, not just the immediately following call to Read or Write. After a deadline has been exceeded, the connection can be refreshed by setting a deadline in the future.

An idle timeout can be implemented by repeatedly extending the deadline after successful Read or Write calls.

A zero value for t means I/O operations will not time out.

func (ServerHttpConnection) SetReadDeadline

func (c ServerHttpConnection) SetReadDeadline(t time.Time) error

SetReadDeadline sets the deadline for future Read calls and any currently-blocked Read call. A zero value for t means Read will not time out.

func (ServerHttpConnection) SetWriteDeadline

func (c ServerHttpConnection) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the deadline for future Write calls and any currently-blocked Write call. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means Write will not time out.

func (ServerHttpConnection) Write

func (c ServerHttpConnection) Write(b []byte) (n int, err error)

Write writes data to the connection. Write can be made to time out and return an Error with Timeout() == true after a fixed time limit; see SetDeadline and SetWriteDeadline.

type ServerUdpConnection

type ServerUdpConnection struct {
	net.Conn
	Connection *net.UDPConn
	Addr       *net.UDPAddr
	RCh        chan []byte
	WCh        chan UdpPacket
	Closed     bool
}

func (ServerUdpConnection) Close

func (u ServerUdpConnection) Close() error

Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.

func (ServerUdpConnection) IsClosed

func (u ServerUdpConnection) IsClosed() bool

func (ServerUdpConnection) LocalAddr

func (u ServerUdpConnection) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (ServerUdpConnection) Read

func (u ServerUdpConnection) Read(b []byte) (n int, err error)

func (ServerUdpConnection) RemoteAddr

func (u ServerUdpConnection) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (ServerUdpConnection) SetDeadline

func (u ServerUdpConnection) SetDeadline(t time.Time) error

SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.

A deadline is an absolute time after which I/O operations fail with a timeout (see type Error) instead of blocking. The deadline applies to all future and pending I/O, not just the immediately following call to Read or Write. After a deadline has been exceeded, the connection can be refreshed by setting a deadline in the future.

An idle timeout can be implemented by repeatedly extending the deadline after successful Read or Write calls.

A zero value for t means I/O operations will not time out.

func (ServerUdpConnection) SetReadDeadline

func (u ServerUdpConnection) SetReadDeadline(t time.Time) error

SetReadDeadline sets the deadline for future Read calls and any currently-blocked Read call. A zero value for t means Read will not time out.

func (ServerUdpConnection) SetWriteDeadline

func (u ServerUdpConnection) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the deadline for future Write calls and any currently-blocked Write call. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means Write will not time out.

func (ServerUdpConnection) Write

func (u ServerUdpConnection) Write(b []byte) (n int, err error)

Write writes data to the connection. Write can be made to time out and return an Error with Timeout() == true after a fixed time limit; see SetDeadline and SetWriteDeadline.

type TunnelDialer

type TunnelDialer interface {
	Dial(network, addr string) (c net.Conn, err error)
	Protocol() TunnelProtocol
}

type TunnelProtocol

type TunnelProtocol string
const (
	Tcp TunnelProtocol = "tcp"
	Tls TunnelProtocol = "tcp"
	Udp TunnelProtocol = "udp"
)

func (TunnelProtocol) String

func (t TunnelProtocol) String() string

type TunnelServer

type TunnelServer interface {
	SetServer(server icommon.TunnelInterfaceServer)
	WaitingForConnection()
	Close() error
	Closed() bool
	HandleConnection(conn net.Conn)
}

type TunnelServerCommon

type TunnelServerCommon struct {
	TunnelServer

	Server   icommon.TunnelInterfaceServer
	Listener net.Listener
	// contains filtered or unexported fields
}

func (TunnelServerCommon) Close

func (s TunnelServerCommon) Close() error

func (TunnelServerCommon) Closed

func (s TunnelServerCommon) Closed() bool

func (TunnelServerCommon) HandleConnection

func (s TunnelServerCommon) HandleConnection(conn net.Conn)

func (TunnelServerCommon) SetServer

func (TunnelServerCommon) WaitingForConnection

func (s TunnelServerCommon) WaitingForConnection()

type UdpPacket

type UdpPacket struct {
	Buffer []byte
	Addr   *net.UDPAddr
}

Jump to

Keyboard shortcuts

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