http

package
v1.2.3-beta.2 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: MIT Imports: 11 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

This section is empty.

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 这种请求不再被认为是有效的。之前本以为connect就可以搞定一切,后来实测发现 wget 确实在 非https时 会用 纯http请求的方式 请求代理。所以 一般 OnlyConnect 为 false即可.
}

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{}

func (ServerCreator) NewServer

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

func (ServerCreator) NewServerFromURL

func (ServerCreator) NewServerFromURL(u *url.URL) (proxy.Server, error)

Jump to

Keyboard shortcuts

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