Documentation ¶
Overview ¶
Package ws is a generated protocol buffer package.
It is generated from these files:
v2ray.com/core/transport/internet/ws/config.proto
It has these top-level messages:
ConnectionReuse Config
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, options internet.DialerOptions) (internet.Connection, error)
- func FindFirstValid(list []*AwaitingConnection) int
- func ListenWS(address v2net.Address, port v2net.Port, options internet.ListenOptions) (internet.Listener, error)
- type AwaitingConnection
- type Config
- type Connection
- func (v *Connection) Close() error
- func (v *Connection) LocalAddr() net.Addr
- func (v *Connection) Read(b []byte) (int, error)
- func (v *Connection) RemoteAddr() net.Addr
- func (v *Connection) Reusable() bool
- func (v *Connection) SetDeadline(t time.Time) error
- func (v *Connection) SetReadDeadline(t time.Time) error
- func (v *Connection) SetReusable(reusable bool)
- func (v *Connection) SetWriteDeadline(t time.Time) error
- func (v *Connection) SysFd() (int, error)
- func (v *Connection) Write(b []byte) (int, error)
- type ConnectionCache
- type ConnectionManager
- type ConnectionReuse
- type ConnectionWithError
- type StoppableListener
- type WSListener
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Dial ¶
func Dial(src v2net.Address, dest v2net.Destination, options internet.DialerOptions) (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 (v *AwaitingConnection) Expired() bool
type Config ¶
type Config struct { // Whether or not to reuse WebSocket connections. ConnectionReuse *ConnectionReuse `protobuf:"bytes,1,opt,name=connection_reuse,json=connectionReuse" json:"connection_reuse,omitempty"` // URL path to the WebSocket service. Empty value means root(/). Path string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"` }
func (*Config) GetConnectionReuse ¶
func (m *Config) GetConnectionReuse() *ConnectionReuse
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(dest string, conn *wsconn, manager ConnectionManager, config *Config) *Connection
func (*Connection) Close ¶
func (v *Connection) Close() error
func (*Connection) LocalAddr ¶
func (v *Connection) LocalAddr() net.Addr
func (*Connection) Read ¶
func (v *Connection) Read(b []byte) (int, error)
func (*Connection) RemoteAddr ¶
func (v *Connection) RemoteAddr() net.Addr
func (*Connection) Reusable ¶
func (v *Connection) Reusable() bool
func (*Connection) SetDeadline ¶
func (v *Connection) SetDeadline(t time.Time) error
func (*Connection) SetReadDeadline ¶
func (v *Connection) SetReadDeadline(t time.Time) error
func (*Connection) SetReusable ¶
func (v *Connection) SetReusable(reusable bool)
func (*Connection) SetWriteDeadline ¶
func (v *Connection) SetWriteDeadline(t time.Time) error
func (*Connection) SysFd ¶
func (v *Connection) SysFd() (int, error)
func (*Connection) Write ¶
func (v *Connection) Write(b []byte) (int, error)
type ConnectionCache ¶
func NewConnectionCache ¶
func NewConnectionCache() *ConnectionCache
func (*ConnectionCache) Cleanup ¶
func (v *ConnectionCache) Cleanup()
func (*ConnectionCache) Get ¶
func (v *ConnectionCache) Get(dest string) net.Conn
func (*ConnectionCache) Recycle ¶
func (v *ConnectionCache) Recycle(dest string, conn *wsconn)
type ConnectionReuse ¶
type ConnectionReuse struct {
Enable bool `protobuf:"varint,1,opt,name=enable" json:"enable,omitempty"`
}
func (*ConnectionReuse) Descriptor ¶
func (*ConnectionReuse) Descriptor() ([]byte, []int)
func (*ConnectionReuse) IsEnabled ¶
func (v *ConnectionReuse) IsEnabled() bool
func (*ConnectionReuse) ProtoMessage ¶
func (*ConnectionReuse) ProtoMessage()
func (*ConnectionReuse) Reset ¶
func (m *ConnectionReuse) Reset()
func (*ConnectionReuse) String ¶
func (m *ConnectionReuse) String() string
type ConnectionWithError ¶
type ConnectionWithError struct {
// contains filtered or unexported fields
}
type StoppableListener ¶
func NewStoppableListener ¶
func NewStoppableListener(l net.Listener) (*StoppableListener, error)
func (*StoppableListener) Accept ¶
func (sl *StoppableListener) Accept() (net.Conn, error)
func (*StoppableListener) Stop ¶
func (sl *StoppableListener) Stop()
type WSListener ¶
func (*WSListener) Accept ¶
func (v *WSListener) Accept() (internet.Connection, error)
func (*WSListener) Addr ¶
func (v *WSListener) Addr() net.Addr
func (*WSListener) Close ¶
func (v *WSListener) Close() error
func (*WSListener) Recycle ¶
func (v *WSListener) Recycle(dest string, conn *wsconn)