# IyovGo **Repository Path**: nicecp/go-iyov ## Basic Information - **Project Name**: IyovGo - **Description**: golang 代理 - **Primary Language**: Go - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-11-01 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # GoIyov #### 介绍 golang 代理 #### 安装教程 ```bash go get github/nicecp/IyovGo ``` #### 支持特性 * HTTP/HTTPS代理 * TLS/SSL解密 * MITM(中间人攻击) * 自定义DNS * Certiface缓存 * Statistic统计(开发中) #### 使用说明 ![软件结构图](docs/IyovGo.jpg) > ***双击 `cert/caRoot.crt`根证书文件,并信任该证书*** ##### 代理使用 ```go import ( "IyovGo" "net/http" "time" ) func main() { proxy := new(IyovGo.Proxy) server := &http.Server{ Addr: ":8888", Handler: http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { proxy.ServerHandler(rw, req) }), ReadTimeout: 30 * time.Second, WriteTimeout: 30 * time.Second, } err := server.ListenAndServe() if err != nil { panic(err) } } ``` ##### MITM(中间人攻击) ```go package main import ( "IyovGo" "IyovGo/entity" "fmt" "net/http" "time" ) type Handler struct { IyovGo.Delegate } func (handler *Handler) BeforeRequest(entity *entity.Entity) { fmt.Printf("%+v",entity.GetRequestBody()) } func (handler *Handler) BeforeResponse(entity *entity.Entity, err error) { fmt.Printf("%+v",entity.GetResponseBody()) } func (handler *Handler) ErrorLog(err error) {} func main() { proxy := IyovGo.NewWithDelegate(&Handler{}) server := &http.Server{ Addr: ":8888", Handler: http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { proxy.ServerHandler(rw, req) }), ReadTimeout: 30 * time.Second, WriteTimeout: 30 * time.Second, } err := server.ListenAndServe() if err != nil { panic(err) } } ```