Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- @aus's branch also includes PR for custom headers, thanks @AkeemMcLennon (closes #90) - support client connections via socks - add more architectures to the built releases - remove vendor (go.sum will enforce correct deps)
- Loading branch information
Showing
11 changed files
with
220 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package chclient | ||
|
||
import ( | ||
"log" | ||
"net/http" | ||
"net/http/httptest" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestCustomHeaders(t *testing.T) { | ||
server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { | ||
if req.Header.Get("Foo") != "Bar" { | ||
t.Fatal("expected header Foo to be 'Bar'") | ||
} | ||
})) | ||
// Close the server when test finishes | ||
defer server.Close() | ||
headers := http.Header{} | ||
headers.Set("Foo", "Bar") | ||
config := Config{ | ||
Fingerprint: "", | ||
Auth: "", | ||
KeepAlive: time.Second, | ||
MaxRetryCount: 0, | ||
MaxRetryInterval: time.Second, | ||
Server: server.URL, | ||
Remotes: []string{"socks"}, | ||
Headers: headers, | ||
} | ||
c, err := NewClient(&config) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
if err = c.Run(); err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.