mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Add response header timeouts to broker transports
The client and proxy use the net/http default transport to make round trip connecitons to the broker. These by default don't time out and can wait indefinitely for the broker to respond if the broker hangs and doesn't terminate the connection.
This commit is contained in:
parent
82031289a3
commit
d5ae7562ac
2 changed files with 3 additions and 0 deletions
|
@ -17,6 +17,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.torproject.org/pluggable-transports/snowflake.git/common/nat"
|
"git.torproject.org/pluggable-transports/snowflake.git/common/nat"
|
||||||
"git.torproject.org/pluggable-transports/snowflake.git/common/util"
|
"git.torproject.org/pluggable-transports/snowflake.git/common/util"
|
||||||
|
@ -48,6 +49,7 @@ type BrokerChannel struct {
|
||||||
func CreateBrokerTransport() http.RoundTripper {
|
func CreateBrokerTransport() http.RoundTripper {
|
||||||
transport := http.DefaultTransport.(*http.Transport)
|
transport := http.DefaultTransport.(*http.Transport)
|
||||||
transport.Proxy = nil
|
transport.Proxy = nil
|
||||||
|
transport.ResponseHeaderTimeout = 15 * time.Second
|
||||||
return transport
|
return transport
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -481,6 +481,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
broker.transport = http.DefaultTransport.(*http.Transport)
|
broker.transport = http.DefaultTransport.(*http.Transport)
|
||||||
|
broker.transport.(*http.Transport).ResponseHeaderTimeout = 15 * time.Second
|
||||||
config = webrtc.Configuration{
|
config = webrtc.Configuration{
|
||||||
ICEServers: []webrtc.ICEServer{
|
ICEServers: []webrtc.ICEServer{
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue