Documentation ¶
Index ¶
- Constants
- Variables
- func AppendMitMRules(r string)
- func ApplyHTTPModifyConfig(config IHttpModifyConfig) (err error)
- func ApplyMITMConfig(config IMITMConfig) error
- func ClearRecords()
- func ConnectFilter(hreq *http.Request, connID int64) (rule *rule2.Rule, server *proxy.Server, conn connect.IConn, err error)
- func CurrentSpeed() (int, int)
- func FilterByReq(req IRequest) (r *rule.Rule, s *proxy.Server, err error)
- func GenerateCA() (mitm *config.Mitm, err error)
- func GetAllowDump() bool
- func GetAllowMitm() bool
- func GetCACert() []byte
- func GetMitMRules() []string
- func HandleHTTP(co net.Conn)
- func HostName(req *http.Request) (host string)
- func HttpTransport(lc, sc connect.IConn, allowDump bool, first *http.Request)
- func InitConfigValue(conf IConfigValue)
- func IsPass(host, port, ip string) bool
- func LoadCA(caPem, keyPem []byte) (*x509.Certificate, *rsa.PrivateKey, error)
- func Mimt(lc, sc connect.IConn) (connect.IConn, connect.IConn, error)
- func ProxyHTTP(lc connect.IConn, hreq *http.Request)
- func ProxyHTTP2()
- func ProxyHTTPS(lc connect.IConn, hreq *http.Request)
- func Recover(fs ...func())
- func RegisterPusher(p Pusher)
- func RemoveMitMRules(r string)
- func RequestModify(req *http.Request, isHttps bool) *http.Response
- func RequestModifyOrMock(req *HttpRequest, hreq *http.Request, isHttps bool) (respBuf []byte, err error)
- func ResponseModify(req *http.Request, resp *http.Response, isHttps bool)
- func SetAllowDump(b bool)
- func SetAllowMitm(b bool)
- func SetDump(d IDump)
- func SetMitMRules(rs []string)
- func SocksHandle(co net.Conn)
- func StrToUint16(v string) (i uint16, err error)
- func ToWriter(w func([]byte) (int, error)) io.Writer
- type Box
- type DirectChannel
- type FileDump
- func (f *FileDump) Clear() error
- func (f *FileDump) Complete(id int64) error
- func (f *FileDump) Dump(id int64) (req io.ReadCloser, reqSize int64, resp io.ReadCloser, respSize int64, ...)
- func (f *FileDump) InitDump(id int64) error
- func (f *FileDump) WriteRequest(id int64, data []byte) (n int, err error)
- func (f *FileDump) WriteResponse(id int64, data []byte) (n int, err error)
- type HttpChannel
- type HttpRequest
- func (r *HttpRequest) Addr() string
- func (r *HttpRequest) Answer() *dns.Answer
- func (r *HttpRequest) Domain() string
- func (r *HttpRequest) Host() string
- func (r *HttpRequest) ID() int64
- func (r *HttpRequest) IP() string
- func (r *HttpRequest) Network() string
- func (r *HttpRequest) Port() string
- func (r *HttpRequest) SetAnswer(answer *dns.Answer)
- type IConfigValue
- type IDump
- type IHttpModifyConfig
- type IMITMConfig
- type IRequest
- type Item
- type LinkedList
- type MinArrange
- type MinHeap
- type ModifyPolicy
- type ModifyValue
- type Pusher
- type Record
- type SequenceHeap
- type Shunt
- type SocksRequest
- func (r *SocksRequest) Addr() string
- func (r *SocksRequest) Answer() *dns.Answer
- func (r *SocksRequest) Domain() string
- func (r *SocksRequest) Host() string
- func (r *SocksRequest) ID() int64
- func (r *SocksRequest) IP() string
- func (r *SocksRequest) Network() string
- func (r *SocksRequest) Port() string
- func (r *SocksRequest) SetAnswer(answer *dns.Answer)
- type Speed
Constants ¶
View Source
const ( DumpOrderWrite = iota DumpOrderClose DumpRequestEntity DumpResponseEntity DumpFileDir = "temp" DumpRequestFile = DumpFileDir + string(os.PathSeparator) + "%d_req.dump" DumpResponseFile = DumpFileDir + string(os.PathSeparator) + "%d_resp.dump" LargeRequestBody = 2 * 1024 * 1024 // 5MB LargeResponseBody = 2 * 1024 * 1024 // 5MB )
View Source
const ( HTTP = "http" HTTPS = "https" )
View Source
const ( ModifyTypeURL = "URL" ModifyTypeHeader = "HEADER" ModifyTypeStatus = "STATUS" ModifyTypeBody = "BODY" ModifyMock = "MOCK" ModifyUpdate = "UPDATE" BodyFileDir = "RespFiles" )
View Source
const ( CmdTCP = 0x01 CmdUDP = 0x03 ProtocolSocks = "SOCKS" ProtocolHttp = "HTTP" ProtocolHttps = "HTTPS" AddrTypeIPv4 = 0x01 // 0x01:IPv4 AddrTypeDomain = 0x03 // 0x03:域名 AddrTypeIPv6 = 0x04 // 0x04:IPv6 )
View Source
const ( RecordStatus = 1 RecordUp = 2 RecordDown = 3 RecordAppend = 4 RecordRemove = 5 RecordStatusActive = "Active" RecordStatusCompleted = "Completed" RecordStatusReject = "Reject" RecordStatusFailed = "Failed" )
Variables ¶
View Source
var ( ControllerDomain string ControllerPort string HTTPProxyPort string )
View Source
var ( ErrorReadTimeOut = errors.New("read time out") ErrorWriteTimeOut = errors.New("write time out") ErrorReject = errors.New("connection reject") ErrorServerNotFound = errors.New("server or server group not found") ErrorUnknowType = errors.New("unknow type") )
View Source
var MitMRules []string
Functions ¶
func AppendMitMRules ¶
func AppendMitMRules(r string)
func ApplyHTTPModifyConfig ¶
func ApplyHTTPModifyConfig(config IHttpModifyConfig) (err error)
func ApplyMITMConfig ¶
func ApplyMITMConfig(config IMITMConfig) error
func ClearRecords ¶
func ClearRecords()
func ConnectFilter ¶
func CurrentSpeed ¶
func GenerateCA ¶
func GetAllowDump ¶
func GetAllowDump() bool
func GetAllowMitm ¶
func GetAllowMitm() bool
func GetMitMRules ¶
func GetMitMRules() []string
func HandleHTTP ¶
func InitConfigValue ¶
func InitConfigValue(conf IConfigValue)
func LoadCA ¶
func LoadCA(caPem, keyPem []byte) (*x509.Certificate, *rsa.PrivateKey, error)
func ProxyHTTP2 ¶
func ProxyHTTP2()
func RemoveMitMRules ¶
func RemoveMitMRules(r string)
func RequestModifyOrMock ¶
func SetAllowDump ¶
func SetAllowDump(b bool)
func SetAllowMitm ¶
func SetAllowMitm(b bool)
func SocksHandle ¶
func StrToUint16 ¶
Types ¶
type DirectChannel ¶
type DirectChannel struct{}
func (*DirectChannel) Transport ¶
func (d *DirectChannel) Transport(lc, sc connect.IConn)
type FileDump ¶
type FileDump struct { sync.RWMutex Actives map[int64]*SequenceHeap // contains filtered or unexported fields }
func (*FileDump) Dump ¶
func (f *FileDump) Dump(id int64) (req io.ReadCloser, reqSize int64, resp io.ReadCloser, respSize int64, err error)
func (*FileDump) WriteRequest ¶
type HttpChannel ¶
type HttpChannel struct {
// contains filtered or unexported fields
}
type HttpRequest ¶
type HttpRequest struct {
// contains filtered or unexported fields
}
HTTP Request
func NewHttpRequest ¶
func (*HttpRequest) Answer ¶
func (r *HttpRequest) Answer() *dns.Answer
func (*HttpRequest) Domain ¶
func (r *HttpRequest) Domain() string
func (*HttpRequest) IP ¶
func (r *HttpRequest) IP() string
func (*HttpRequest) Network ¶
func (r *HttpRequest) Network() string
func (*HttpRequest) Port ¶
func (r *HttpRequest) Port() string
func (*HttpRequest) SetAnswer ¶
func (r *HttpRequest) SetAnswer(answer *dns.Answer)
type IConfigValue ¶
type IDump ¶
type IHttpModifyConfig ¶
type LinkedList ¶
func (*LinkedList) Append ¶
func (l *LinkedList) Append(r *Record)
func (*LinkedList) Clear ¶
func (l *LinkedList) Clear()
func (*LinkedList) Get ¶
func (l *LinkedList) Get(id int64) *Record
func (*LinkedList) List ¶
func (l *LinkedList) List() []Record
func (*LinkedList) Put ¶
func (l *LinkedList) Put(id int64, op int, v interface{})
type MinArrange ¶
func NewMinArrange ¶
func NewMinArrange() *MinArrange
func (*MinArrange) Close ¶
func (m *MinArrange) Close()
func (*MinArrange) Pop ¶
func (m *MinArrange) Pop() (item *Item)
func (*MinArrange) Push ¶
func (m *MinArrange) Push(v *Item)
type ModifyPolicy ¶
type ModifyPolicy struct { Type string UrlRex string MVs []*ModifyValue // contains filtered or unexported fields }
type ModifyValue ¶
type Record ¶
type Record struct { ID int64 Protocol string Created time.Time Proxy *proxy.Server Rule *rule.Rule Status string Up int Down int URL string Dumped bool }
func GetRecords ¶
func GetRecords() []Record
type SequenceHeap ¶
type SequenceHeap struct { *MinArrange // contains filtered or unexported fields }
func NewSequenceHeap ¶
func NewSequenceHeap() *SequenceHeap
func (*SequenceHeap) Pop ¶
func (s *SequenceHeap) Pop() interface{}
func (*SequenceHeap) Push ¶
func (s *SequenceHeap) Push(v interface{})
type SocksRequest ¶
type SocksRequest struct {
// contains filtered or unexported fields
}
|VER | CMD | RSV | ATYP | DST.ADDR | DST.PORT |
func (*SocksRequest) Answer ¶
func (r *SocksRequest) Answer() *dns.Answer
func (*SocksRequest) Domain ¶
func (r *SocksRequest) Domain() string
func (*SocksRequest) IP ¶
func (r *SocksRequest) IP() string
func (*SocksRequest) Network ¶
func (r *SocksRequest) Network() string
func (*SocksRequest) Port ¶
func (r *SocksRequest) Port() string
func (*SocksRequest) SetAnswer ¶
func (r *SocksRequest) SetAnswer(answer *dns.Answer)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.