Skip to content

Commit 929cc04

Browse files
renamings to fix api
1 parent 83ca619 commit 929cc04

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

gohpts.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func isLocalAddress(addr string) bool {
100100
return strings.HasSuffix(host, ".local") || host == "localhost"
101101
}
102102

103-
type proxyApp struct {
103+
type proxyapp struct {
104104
httpServer *http.Server
105105
sockClient *http.Client
106106
httpClient *http.Client
@@ -111,7 +111,7 @@ type proxyApp struct {
111111
httpServerAddr string
112112
user string
113113
pass string
114-
proxychain Chain
114+
proxychain chain
115115
proxylist []proxyEntry
116116
rrIndex uint32
117117
rrIndexReset uint32
@@ -120,7 +120,7 @@ type proxyApp struct {
120120
availProxyList []proxyEntry
121121
}
122122

123-
func (p *proxyApp) printProxyChain(pc []proxyEntry) string {
123+
func (p *proxyapp) printProxyChain(pc []proxyEntry) string {
124124
var sb strings.Builder
125125
sb.WriteString("client -> ")
126126
sb.WriteString(p.httpServerAddr)
@@ -133,7 +133,7 @@ func (p *proxyApp) printProxyChain(pc []proxyEntry) string {
133133
return sb.String()
134134
}
135135

136-
func (p *proxyApp) updateSocksList() {
136+
func (p *proxyapp) updateSocksList() {
137137
p.mu.Lock()
138138
defer p.mu.Unlock()
139139
p.availProxyList = p.availProxyList[:0]
@@ -210,7 +210,7 @@ func shuffle(vals []proxyEntry) {
210210
}
211211
}
212212

213-
func (p *proxyApp) getSocks() (proxy.Dialer, *http.Client, error) {
213+
func (p *proxyapp) getSocks() (proxy.Dialer, *http.Client, error) {
214214
if p.proxylist == nil {
215215
return p.sockDialer, p.sockClient, nil
216216
}
@@ -285,7 +285,7 @@ func (p *proxyApp) getSocks() (proxy.Dialer, *http.Client, error) {
285285
return dialer, socks, nil
286286
}
287287

288-
func (p *proxyApp) doReq(w http.ResponseWriter, r *http.Request, sock *http.Client) *http.Response {
288+
func (p *proxyapp) doReq(w http.ResponseWriter, r *http.Request, sock *http.Client) *http.Response {
289289
var (
290290
resp *http.Response
291291
err error
@@ -313,7 +313,7 @@ func (p *proxyApp) doReq(w http.ResponseWriter, r *http.Request, sock *http.Clie
313313
return resp
314314
}
315315

316-
func (p *proxyApp) handleForward(w http.ResponseWriter, r *http.Request) {
316+
func (p *proxyapp) handleForward(w http.ResponseWriter, r *http.Request) {
317317

318318
req, err := http.NewRequest(r.Method, r.URL.String(), r.Body)
319319
if err != nil {
@@ -435,7 +435,7 @@ func (p *proxyApp) handleForward(w http.ResponseWriter, r *http.Request) {
435435
close(done)
436436
}
437437

438-
func (p *proxyApp) handleTunnel(w http.ResponseWriter, r *http.Request) {
438+
func (p *proxyapp) handleTunnel(w http.ResponseWriter, r *http.Request) {
439439
var dstConn net.Conn
440440
var err error
441441
if isLocalAddress(r.Host) {
@@ -489,7 +489,7 @@ func (p *proxyApp) handleTunnel(w http.ResponseWriter, r *http.Request) {
489489
wg.Wait()
490490
}
491491

492-
func (p *proxyApp) transfer(wg *sync.WaitGroup, destination io.Writer, source io.Reader, destName, srcName string) {
492+
func (p *proxyapp) transfer(wg *sync.WaitGroup, destination io.Writer, source io.Reader, destName, srcName string) {
493493
defer wg.Done()
494494
n, err := io.Copy(destination, source)
495495
if err != nil {
@@ -524,7 +524,7 @@ func parseProxyAuth(auth string) (username, password string, ok bool) {
524524
return username, password, true
525525
}
526526

527-
func (p *proxyApp) proxyAuth(next http.HandlerFunc) http.HandlerFunc {
527+
func (p *proxyapp) proxyAuth(next http.HandlerFunc) http.HandlerFunc {
528528
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
529529
auth := r.Header.Get("Proxy-Authorization")
530530
r.Header.Del("Proxy-Authorization")
@@ -548,7 +548,7 @@ func (p *proxyApp) proxyAuth(next http.HandlerFunc) http.HandlerFunc {
548548
})
549549
}
550550

551-
func (p *proxyApp) handler() http.HandlerFunc {
551+
func (p *proxyapp) handler() http.HandlerFunc {
552552
return func(w http.ResponseWriter, r *http.Request) {
553553
if r.Method == http.MethodConnect {
554554
p.handleTunnel(w, r)
@@ -558,7 +558,7 @@ func (p *proxyApp) handler() http.HandlerFunc {
558558
}
559559
}
560560

561-
func (p *proxyApp) Run() {
561+
func (p *proxyapp) Run() {
562562
done := make(chan bool)
563563
quit := make(chan os.Signal, 1)
564564
signal.Notify(quit, os.Interrupt)
@@ -640,22 +640,22 @@ func (pe proxyEntry) String() string {
640640
return pe.Address
641641
}
642642

643-
type Server struct {
643+
type server struct {
644644
Address string `yaml:"address"`
645645
Username string `yaml:"username,omitempty"`
646646
Password string `yaml:"password,omitempty"`
647647
CertFile string `yaml:"cert_file,omitempty"`
648648
KeyFile string `yaml:"key_file,omitempty"`
649649
}
650-
type Chain struct {
650+
type chain struct {
651651
Type string `yaml:"type"`
652652
Length int `yaml:"length"`
653653
}
654654

655655
type serverConfig struct {
656-
Chain Chain `yaml:"chain"`
656+
Chain chain `yaml:"chain"`
657657
ProxyList []proxyEntry `yaml:"proxy_list"`
658-
Server Server `yaml:"server"`
658+
Server server `yaml:"server"`
659659
}
660660

661661
func getFullAddress(v string) string {
@@ -681,9 +681,9 @@ func expandPath(p string) string {
681681
return p
682682
}
683683

684-
func New(conf *Config) *proxyApp {
684+
func New(conf *Config) *proxyapp {
685685
var logger zerolog.Logger
686-
var p proxyApp
686+
var p proxyapp
687687
if conf.Json {
688688
log.SetFlags(0)
689689
log.SetOutput(new(jsonLogWriter))

0 commit comments

Comments
 (0)