http

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package http implements http proxy for proxy.Server.

Reference

rfc: https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.6

about basic auth:

https://en.wikipedia.org/wiki/Basic_access_authentication

https://datatracker.ietf.org/doc/html/rfc7617

example header:

Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

Index

Constants

View Source
const Name = "http"

Variables

This section is empty.

Functions

func SetupTmpProxyServer added in v1.2.3

func SetupTmpProxyServer() (clientEndInServer proxy.Server, proxyUrl string, err error)

Types

type ProxyConn

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

用于纯http的 代理,dial后,第一次要把客户端的数据原封不动发送给远程服务端 就是说,第一次从 ProxyConn Read时,读到的一定是之前读过的数据,原理有点像 fallback

func (*ProxyConn) Read

func (pc *ProxyConn) Read(p []byte) (int, error)

func (*ProxyConn) ReadFrom

func (pc *ProxyConn) ReadFrom(r io.Reader) (n int64, e error)

ReadFrom implements the io.ReaderFrom ReadFrom method. 专门用于适配 tcp的splice.

type Server

type Server struct {
	proxy.Base

	*utils.MultiUserMap

	OnlyConnect bool //是否仅支持Connect命令; 如果为true, 则直接通过 GET http://xxx 这种请求不再被认为是有效的。

}

implements proxy.Server

func NewServer added in v1.2.3

func NewServer() *Server

func (*Server) CanFallback

func (s *Server) CanFallback() bool

func (*Server) Handshake

func (s *Server) Handshake(underlay net.Conn) (newconn net.Conn, _ netLayer.MsgConn, targetAddr netLayer.Addr, err error)

func (*Server) Name

func (*Server) Name() string

type ServerCreator

type ServerCreator struct{ proxy.CreatorCommonStruct }

func (ServerCreator) NewServer

func (ServerCreator) NewServer(lc *proxy.ListenConf) (proxy.Server, error)

func (ServerCreator) URLToListenConf added in v1.2.4

func (ServerCreator) URLToListenConf(u *url.URL, lc *proxy.ListenConf, format int) (*proxy.ListenConf, error)

Jump to

Keyboard shortcuts

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