mirror of
https://github.com/whyvl/wireproxy.git
synced 2025-06-28 08:58:02 +02:00
Add support for http proxy (#68)
* Add support for http proxy * add test case for http proxy --------- Co-authored-by: octeep <github@bandersnatch.anonaddy.com> Co-authored-by: pufferfish <74378430+pufferffish@users.noreply.github.com>
This commit is contained in:
parent
d9c6eb7143
commit
25e6568f4d
7 changed files with 256 additions and 4 deletions
16
routine.go
16
routine.go
|
@ -137,6 +137,22 @@ func (config *Socks5Config) SpawnRoutine(vt *VirtualTun) {
|
|||
}
|
||||
}
|
||||
|
||||
// SpawnRoutine spawns a http server.
|
||||
func (config *HTTPConfig) SpawnRoutine(vt *VirtualTun) {
|
||||
http := &HTTPServer{
|
||||
config: config,
|
||||
dial: vt.Tnet.Dial,
|
||||
auth: CredentialValidator{config.Username, config.Password},
|
||||
}
|
||||
if config.Username != "" || config.Password != "" {
|
||||
http.authRequired = true
|
||||
}
|
||||
|
||||
if err := http.ListenAndServe("tcp", config.BindAddress); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Valid checks the authentication data in CredentialValidator and compare them
|
||||
// to username and password in constant time.
|
||||
func (c CredentialValidator) Valid(username, password string) bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue