mirror of
https://github.com/boringproxy/boringproxy.git
synced 2025-02-25 18:55:29 -06:00
Merge branch 'master' of github.com:boringproxy/boringproxy into raw-tls-tunnels
This commit is contained in:
commit
272acb9d95
16
README.md
16
README.md
@ -3,10 +3,17 @@ boringproxy offers full integration with TakingNames.io, providing the simplest
|
||||
way to get up and running with your own domain. More information [here](https://takingnames.io/blog/introducing-takingnames-io),
|
||||
and a demo video of boringproxy working with TakingNames.io [here](https://youtu.be/9hf72-fYTts).
|
||||
|
||||
<a href='https://takingnames.io'>
|
||||
<a href='https://takingnames.io/blog/introducing-takingnames-io'>
|
||||
<img src='https://user-images.githubusercontent.com/7820200/148330003-5f8062ff-22b2-423d-b945-3db87abf10e5.png' width='400'></img>
|
||||
</a>
|
||||
|
||||
# Getting Help
|
||||
|
||||
If you run into problems running boringproxy, the best place to ask for help is
|
||||
over at the [IndieBits][0] community, where we have a [dedicated section][1]
|
||||
for boringproxy support. If you think you've found a bug, or want to discuss
|
||||
development, please [open an issue][2].
|
||||
|
||||
|
||||
# What is boringproxy?
|
||||
|
||||
@ -74,13 +81,6 @@ sudo setcap cap_net_bind_service=+ep boringproxy
|
||||
./boringproxy client -server bpdemo.brng.pro -token fKFIjefKDFLEFijKDFJKELJF -client-name demo-client -user demo-user
|
||||
```
|
||||
|
||||
# Getting Help
|
||||
|
||||
If you run into problems running boringproxy, the best place to ask for help is
|
||||
over at the [IndieBits][0] community, where we have a [dedicated section][1]
|
||||
for boringproxy support. If you think you've found a bug, or want to discuss
|
||||
development, please [open an issue][2].
|
||||
|
||||
[0]: https://forum.indiebits.io
|
||||
|
||||
[1]: https://forum.indiebits.io/c/boringproxy-support/9
|
||||
|
@ -279,7 +279,7 @@ func Listen() {
|
||||
return
|
||||
}
|
||||
|
||||
proxyRequest(w, r, tunnel, httpClient, tunnel.TunnelPort, *behindProxy)
|
||||
proxyRequest(w, r, tunnel, httpClient, "localhost", tunnel.TunnelPort, *behindProxy)
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -297,7 +297,7 @@ func (c *Client) BoreTunnel(ctx context.Context, tunnel Tunnel) error {
|
||||
httpMux := http.NewServeMux()
|
||||
|
||||
httpMux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
proxyRequest(w, r, tunnel, c.httpClient, tunnel.ClientPort, c.behindProxy)
|
||||
proxyRequest(w, r, tunnel, c.httpClient, tunnel.ClientAddress, tunnel.ClientPort, c.behindProxy)
|
||||
})
|
||||
|
||||
httpServer := &http.Server{
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func proxyRequest(w http.ResponseWriter, r *http.Request, tunnel Tunnel, httpClient *http.Client, port int, behindProxy bool) {
|
||||
func proxyRequest(w http.ResponseWriter, r *http.Request, tunnel Tunnel, httpClient *http.Client, address string, port int, behindProxy bool) {
|
||||
|
||||
if tunnel.AuthUsername != "" || tunnel.AuthPassword != "" {
|
||||
username, password, ok := r.BasicAuth()
|
||||
@ -29,9 +29,7 @@ func proxyRequest(w http.ResponseWriter, r *http.Request, tunnel Tunnel, httpCli
|
||||
|
||||
downstreamReqHeaders := r.Header.Clone()
|
||||
|
||||
// TODO: should probably pass in address instead of using localhost,
|
||||
// mostly for client-terminated TLS
|
||||
upstreamAddr := fmt.Sprintf("localhost:%d", port)
|
||||
upstreamAddr := fmt.Sprintf("%s:%d", address, port)
|
||||
upstreamUrl := fmt.Sprintf("http://%s%s", upstreamAddr, r.URL.RequestURI())
|
||||
|
||||
upstreamReq, err := http.NewRequest(r.Method, upstreamUrl, r.Body)
|
||||
|
Loading…
Reference in New Issue
Block a user