h2proxy

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2019 License: MIT Imports: 20 Imported by: 0

README

h2proxy

Go Report Card Build Status

http2 proxy server && client

Android Client

Documentation

Index

Constants

View Source
const (
	HTTP    = "http"
	SERVER  = "server"
	SOCKSV5 = "socks5"

	LOCAL_HOST = "local_host"
	LOCAL_PORT = "local_port"

	PROXY_HOST = "proxy_host"
	PROXY_PORT = "proxy_port"
)

Variables

View Source
var Debug = false

global config

Functions

func CheckAuth

func CheckAuth(u *UserInfo, r *http.Request) bool

检查请求中的 auth信息 和 用户信息是否一致

func CreateTunnel

func CreateTunnel(from net.Conn, remoteAddr string, config *ClientConfig)

create http request with connect method

func GetMethod

func GetMethod(from *http.Request, remote string, to net.Conn, config *ClientConfig)

not connectMethod method (http not https,don't need tunnel)

func InitLogger

func InitLogger()

func NewTransport

func NewTransport(proxyAddr string) *http2.Transport

make new transport

func ParseConfig

func ParseConfig() (category string, config interface{})

func SetAuthInHeader

func SetAuthInHeader(u *UserInfo, req *http.Request)

在 hesder 中设置 auth

Types

type ClientConfig

type ClientConfig struct {
	Local    string
	Proxy    string
	NeedAuth bool
	User     *UserInfo
	Pprof    int
	Category string
}

type FileConfig

type FileConfig struct {
	Category string
	Server   *ServerConfig
	Client   *ClientConfig
}

type H2proxy

type H2proxy interface {
	Start()
}

type Http2Server

type Http2Server struct {
	Config *ServerConfig
}

func (Http2Server) Start

func (h Http2Server) Start()

type HttpProxy

type HttpProxy struct {
	Config *ClientConfig
}

func (HttpProxy) Start

func (h HttpProxy) Start()

type ServerConfig

type ServerConfig struct {
	Server   string
	CaKey    string
	CaCrt    string
	NeedAuth bool
	User     *UserInfo
	Pprof    int
}

type Sock5Proxy

type Sock5Proxy struct {
	Config *ClientConfig
}

func (Sock5Proxy) Start

func (s Sock5Proxy) Start()

type UserInfo

type UserInfo struct {
	Username string
	Passwd   string
}

func (*UserInfo) String

func (u *UserInfo) String() string

func (*UserInfo) ToBase64

func (u *UserInfo) ToBase64() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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