betproxy

package module
v0.0.0-...-a566e09 Latest Latest
Warning

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

Go to latest
Published: May 7, 2019 License: Apache-2.0 Imports: 15 Imported by: 2

README

betproxy

HTTP/HTTPS MITM proxy framework

License Travis branch Coverage Status Go Report Card GoDoc

Application

  1. Gotit: Golang Package Cache Proxy
  2. Example: Forward Proxy

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPError

func HTTPError(code int, err string, req *http.Request) *http.Response

HTTPError create a http.Response with giving error message

func HTTPText

func HTTPText(code int, header http.Header, text string, req *http.Request) *http.Response

HTTPText create a http.Response with giving text

func NewResponse

func NewResponse(code int, header http.Header, body io.Reader, req *http.Request) *http.Response

NewResponse create a http.Response

Types

type Client

type Client interface {
	Do(req *http.Request) (*http.Response, error)
}

Client each request is handled by the client

type Service

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

Service is the proxy server

func NewService

func NewService(address string, tlsCfg *mitm.Config) (*Service, error)

NewService create a Service instance The address is that the proxy server listen on, and the tlsCfg will be used to sign the https website

func (*Service) Close

func (s *Service) Close() (err error)

Close proxy server

func (*Service) Listen

func (s *Service) Listen() error

Listen proxy server start accept connection

func (*Service) OnAcceptHandler

func (s *Service) OnAcceptHandler(conn net.Conn)

OnAcceptHandler each connection is handled by this method

func (*Service) SetClient

func (s *Service) SetClient(client Client)

SetClient as name

type Session

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

Session parse the protocol on the connection and call Client.Do handle every http request

func (*Session) Close

func (s *Session) Close() error

Close connection

type TCPServer

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

TCPServer as name

func NewTCPServer

func NewTCPServer(address string) (*TCPServer, error)

NewTCPServer create new tcp server

func (*TCPServer) Close

func (s *TCPServer) Close() (err error)

Close server

func (*TCPServer) Serve

func (s *TCPServer) Serve(onAcceptHandler func(net.Conn)) error

Serve start accetp new connection and call onAcceptHandler

Directories

Path Synopsis
Package mitm provides tooling for MITMing TLS connections.
Package mitm provides tooling for MITMing TLS connections.

Jump to

Keyboard shortcuts

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