Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
ginuerzh committed Jan 2, 2019
1 parent 82003f4 commit 0f824ed
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ gost - GO Simple Tunnel
[![GoDoc](https://godoc.org/github.com/ginuerzh/gost?status.svg)](https://godoc.org/github.com/ginuerzh/gost)
[![Build Status](https://travis-ci.org/ginuerzh/gost.svg?branch=master)](https://travis-ci.org/ginuerzh/gost)
[![Go Report Card](https://goreportcard.com/badge/github.com/ginuerzh/gost)](https://goreportcard.com/report/github.com/ginuerzh/gost)
[![codecov](https://codecov.io/gh/ginuerzh/gost/branch/2.7/graphs/badge.svg)](https://codecov.io/gh/ginuerzh/gost/branch/2.7)
[![GitHub release](https://img.shields.io/github/release/ginuerzh/gost.svg)](https://github.com/ginuerzh/gost/releases/latest)
[![Snap Status](https://build.snapcraft.io/badge/ginuerzh/gost.svg)](https://build.snapcraft.io/user/ginuerzh/gost)
[![Docker Build Status](https://img.shields.io/docker/build/ginuerzh/gost.svg)](https://hub.docker.com/r/ginuerzh/gost/)
Expand Down
1 change: 1 addition & 0 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ gost - GO Simple Tunnel
[![GoDoc](https://godoc.org/github.com/ginuerzh/gost?status.svg)](https://godoc.org/github.com/ginuerzh/gost)
[![Build Status](https://travis-ci.org/ginuerzh/gost.svg?branch=master)](https://travis-ci.org/ginuerzh/gost)
[![Go Report Card](https://goreportcard.com/badge/github.com/ginuerzh/gost)](https://goreportcard.com/report/github.com/ginuerzh/gost)
[![codecov](https://codecov.io/gh/ginuerzh/gost/branch/2.7/graphs/badge.svg)](https://codecov.io/gh/ginuerzh/gost/branch/2.7)
[![GitHub release](https://img.shields.io/github/release/ginuerzh/gost.svg)](https://github.com/ginuerzh/gost/releases/latest)
[![Snap Status](https://build.snapcraft.io/badge/ginuerzh/gost.svg)](https://build.snapcraft.io/user/ginuerzh/gost)
[![Docker Build Status](https://img.shields.io/docker/build/ginuerzh/gost.svg)](https://hub.docker.com/r/ginuerzh/gost/)
Expand Down
13 changes: 6 additions & 7 deletions bypass.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ func NewBypassPatterns(reversed bool, patterns ...string) *Bypass {
matchers = append(matchers, m)
}
}
return NewBypass(reversed, matchers...)
bp := NewBypass(reversed)
bp.AddMatchers(matchers...)
return bp
}

// Contains reports whether the bypass includes addr.
Expand Down Expand Up @@ -307,13 +309,10 @@ func (bp *Bypass) Stopped() bool {
}

func (bp *Bypass) String() string {
bp.mux.RLock()
defer bp.mux.RUnlock()

b := &bytes.Buffer{}
fmt.Fprintf(b, "reversed: %v\n", bp.reversed)
fmt.Fprintf(b, "reload: %v\n", bp.period)
for _, m := range bp.matchers {
fmt.Fprintf(b, "reversed: %v\n", bp.Reversed())
fmt.Fprintf(b, "reload: %v\n", bp.Period())
for _, m := range bp.Matchers() {
b.WriteString(m.String())
b.WriteByte('\n')
}
Expand Down
6 changes: 5 additions & 1 deletion http2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,11 +970,15 @@ func TestHTTP2ProxyWithWebProbeResist(t *testing.T) {
Transporter: HTTP2Transporter(nil),
}

u, err := url.Parse(httpSrv.URL)
if err != nil {
t.Error(err)
}
server := &Server{
Listener: ln,
Handler: HTTP2Handler(
UsersHandlerOption(url.UserPassword("admin", "123456")),
ProbeResistHandlerOption("web:"+httpSrv.URL),
ProbeResistHandlerOption("web:"+u.Host),
),
}
go server.Run()
Expand Down
6 changes: 5 additions & 1 deletion http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,15 @@ func TestHTTPProxyWithWebProbeResist(t *testing.T) {
t.Error(err)
}

u, err := url.Parse(httpSrv.URL)
if err != nil {
t.Error(err)
}
server := &Server{
Listener: ln,
Handler: HTTPHandler(
UsersHandlerOption(url.UserPassword("admin", "123456")),
ProbeResistHandlerOption("web:"+httpSrv.URL),
ProbeResistHandlerOption("web:"+u.Host),
),
}
go server.Run()
Expand Down

0 comments on commit 0f824ed

Please sign in to comment.