Documentation ¶
Overview ¶
Package ws implements Websocket transport
Websocket transport implements a HTTP(S) compliable, surveillance proof transport method with plausible deniability.
To configure such a listener, set streamSettings to be ws. A http(s) listener will be listening at the port you have configured.
There is additional configure can be made at transport configure.
"wsSettings":{ "Path":"ws", // the path our ws handler bind "Pto": "wss/ws", // the transport protocol we are using ws or wss(listen ws with tls) "Cert":"cert.pem", // if you have configured to use wss, configure your cert here "PrivKey":"priv.pem" //if you have configured to use wss, configure your privatekey here }
To configure such a Dialer, set streamSettings to be ws.
There is additional configure can be made at transport configure.
"wsSettings":{ "Path":"ws", // the path our ws handler bind "Pto": "wss/ws", // the transport protocol we are using ws or wss(listen ws with tls) }
It is worth noting that accepting a non-valid cert is not supported as a self-signed or invalid cert can be a sign of a website that is not correctly configured and lead to additional investigation.
This transport was disscussed at https://github.com/v2ray/v2ray-core/issues/224
Index ¶
- Variables
- func Dial(src v2net.Address, dest v2net.Destination) (internet.Connection, error)
- func FindFirstValid(list []*AwaitingConnection) int
- func ListenWS(address v2net.Address, port v2net.Port) (internet.Listener, error)
- type AwaitingConnection
- type Config
- type Connection
- func (this *Connection) Close() error
- func (this *Connection) LocalAddr() net.Addr
- func (this *Connection) Read(b []byte) (int, error)
- func (this *Connection) RemoteAddr() net.Addr
- func (this *Connection) Reusable() bool
- func (this *Connection) SetDeadline(t time.Time) error
- func (this *Connection) SetReadDeadline(t time.Time) error
- func (this *Connection) SetReusable(reusable bool)
- func (this *Connection) SetWriteDeadline(t time.Time) error
- func (this *Connection) SysFd() (int, error)
- func (this *Connection) Write(b []byte) (int, error)
- type ConnectionCache
- type ConnectionManager
- type ConnectionWithError
- type StoppableListener
- type WSListener
Constants ¶
This section is empty.
Variables ¶
var (
ErrClosedListener = errors.New("Listener is closed.")
)
var (
ErrInvalidConn = errors.New("Invalid Connection.")
)
var StoppedError = errors.New("Listener stopped")
Functions ¶
func Dial ¶
func Dial(src v2net.Address, dest v2net.Destination) (internet.Connection, error)
func FindFirstValid ¶
func FindFirstValid(list []*AwaitingConnection) int
Types ¶
type AwaitingConnection ¶
type AwaitingConnection struct {
// contains filtered or unexported fields
}
func (*AwaitingConnection) Expired ¶
func (this *AwaitingConnection) Expired() bool
type Config ¶
type Config struct { ConnectionReuse bool Path string Pto string Cert string PrivKey string DeveloperInsecureSkipVerify bool }
func (*Config) UnmarshalJSON ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(dest string, conn *wsconn, manager ConnectionManager) *Connection
func (*Connection) Close ¶
func (this *Connection) Close() error
func (*Connection) LocalAddr ¶
func (this *Connection) LocalAddr() net.Addr
func (*Connection) RemoteAddr ¶
func (this *Connection) RemoteAddr() net.Addr
func (*Connection) Reusable ¶
func (this *Connection) Reusable() bool
func (*Connection) SetDeadline ¶
func (this *Connection) SetDeadline(t time.Time) error
func (*Connection) SetReadDeadline ¶
func (this *Connection) SetReadDeadline(t time.Time) error
func (*Connection) SetReusable ¶
func (this *Connection) SetReusable(reusable bool)
func (*Connection) SetWriteDeadline ¶
func (this *Connection) SetWriteDeadline(t time.Time) error
func (*Connection) SysFd ¶
func (this *Connection) SysFd() (int, error)
type ConnectionCache ¶
func NewConnectionCache ¶
func NewConnectionCache() *ConnectionCache
func (*ConnectionCache) Cleanup ¶
func (this *ConnectionCache) Cleanup()
func (*ConnectionCache) Recycle ¶
func (this *ConnectionCache) Recycle(dest string, conn *wsconn)
type ConnectionManager ¶
type ConnectionManager interface {
Recycle(string, *wsconn)
}
type ConnectionWithError ¶
type ConnectionWithError struct {
// contains filtered or unexported fields
}
type StoppableListener ¶
func NewStoppableListener ¶
func NewStoppableListener(l net.Listener) (*StoppableListener, error)
func (*StoppableListener) Stop ¶
func (sl *StoppableListener) Stop()
type WSListener ¶
func (*WSListener) Accept ¶
func (this *WSListener) Accept() (internet.Connection, error)
func (*WSListener) Addr ¶
func (this *WSListener) Addr() net.Addr
func (*WSListener) Close ¶
func (this *WSListener) Close() error
func (*WSListener) Recycle ¶
func (this *WSListener) Recycle(dest string, conn *wsconn)