http

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: GPL-3.0 Imports: 14 Imported by: 9

Documentation

Overview

Package http implements a http proxy.

Index

Constants

This section is empty.

Variables

View Source
var Methods = [...][]byte{
	[]byte("GET"),
	[]byte("POST"),
	[]byte("PUT"),
	[]byte("DELETE"),
	[]byte("CONNECT"),
	[]byte("HEAD"),
	[]byte("OPTIONS"),
	[]byte("TRACE"),
	[]byte("PATCH"),
}

Methods are http methods from rfc. https://www.rfc-editor.org/rfc/rfc2616, http methods must be uppercase

Functions

func NewHTTPDialer

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

NewHTTPDialer returns a http proxy dialer.

func NewHTTPServer

func NewHTTPServer(s string, p proxy.Proxy) (proxy.Server, error)

NewHTTPServer returns a http proxy server.

Types

type HTTP

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

HTTP struct.

func NewHTTP

func NewHTTP(s string, d proxy.Dialer, p proxy.Proxy) (*HTTP, error)

NewHTTP returns a http proxy.

func (*HTTP) Addr

func (s *HTTP) Addr() string

Addr returns forwarder's address.

func (*HTTP) Dial

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

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

func (*HTTP) DialUDP

func (s *HTTP) DialUDP(network, addr string) (pc net.PacketConn, writeTo net.Addr, err error)

DialUDP connects to the given address via the proxy.

func (*HTTP) ListenAndServe

func (s *HTTP) ListenAndServe()

ListenAndServe listens on server's addr and serves connections.

func (*HTTP) Serve

func (s *HTTP) Serve(cc net.Conn)

Serve serves a connection.

Jump to

Keyboard shortcuts

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