ws

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: GPL-3.0 Imports: 16 Imported by: 3

Documentation

Overview

Package ws implements a simple websocket client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FrameReader

func FrameReader(r io.Reader) io.Reader

FrameReader returns a chunked reader.

func FrameWriter

func FrameWriter(w io.Writer) io.Writer

FrameWriter returns a frame writer.

func NewWSDialer

func NewWSDialer(s string, d proxy.Dialer) (proxy.Dialer, error)

NewWSDialer returns a ws proxy dialer.

Types

type Client

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

Client is ws client struct.

func NewClient

func NewClient(host, path string) (*Client, error)

NewClient creates a new ws client.

func (*Client) NewConn

func (c *Client) NewConn(rc net.Conn, target string) (*Conn, error)

NewConn creates a new ws client connection.

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

Conn is a connection to ws server.

func (*Conn) Handshake

func (c *Conn) Handshake(host, path string) error

Handshake handshakes with the server using HTTP to request a protocol upgrade.

func (*Conn) Read

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

func (*Conn) Write

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

type WS

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

WS is the base ws proxy struct.

func NewWS

func NewWS(s string, d proxy.Dialer) (*WS, error)

NewWS returns a websocket proxy.

func (*WS) Addr

func (s *WS) Addr() string

Addr returns forwarder's address.

func (*WS) Dial

func (s *WS) Dial(network, addr string) (net.Conn, error)

Dial connects to the address addr on the network net via the proxy.

func (*WS) DialUDP

func (s *WS) DialUDP(network, addr string) (net.PacketConn, net.Addr, error)

DialUDP connects to the given address via the proxy.

Jump to

Keyboard shortcuts

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