server: director
This commit is contained in:
parent
d65737df24
commit
2ab2f2d762
|
@ -160,6 +160,10 @@ func (s *Server) onionPath(name string) string {
|
||||||
return filepath.Join(s.cfg.TorDataDir, name)
|
return filepath.Join(s.cfg.TorDataDir, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) Director(r *http.Request) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
r.Header.Del("X-Forwarded-For")
|
r.Header.Del("X-Forwarded-For")
|
||||||
|
|
||||||
|
@ -185,7 +189,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("X-Clacks-Overhead", "GNU Ashlynn")
|
w.Header().Set("X-Clacks-Overhead", "GNU Ashlynn")
|
||||||
|
|
||||||
if strings.HasSuffix(r.Host, ".onion") {
|
if strings.HasSuffix(r.Host, ".onion") {
|
||||||
w.Header().Add("DNT", "1")
|
r.Header.Add("DNT", "1")
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.RequestURI == rpc.DefaultRPCPath {
|
if r.RequestURI == rpc.DefaultRPCPath {
|
||||||
|
@ -194,6 +198,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
rp := &httputil.ReverseProxy{
|
rp := &httputil.ReverseProxy{
|
||||||
|
Director: s.Director,
|
||||||
Transport: s.ts,
|
Transport: s.ts,
|
||||||
FlushInterval: 1 * time.Second,
|
FlushInterval: 1 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue