/*
GoVPN -- simple secure free software virtual private network daemon
-Copyright (C) 2014-2015 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2014-2016 Sergey Matveev <stargrave@stargrave.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
"net/http"
)
-type proxyHandler struct {
- sink chan Pkt
-}
+type proxyHandler struct{}
func (p proxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
conn, _, err := w.(http.Hijacker).Hijack()
return
}
conn.Write([]byte("HTTP/1.0 200 OK\n\n"))
- ready := make(chan struct{}, 1)
- go handleTCP(conn, p.sink, ready)
- ready <- struct{}{}
-
+ go handleTCP(conn)
}
-func proxyStart(sink chan Pkt) {
- log.Println("HTTP proxy listening on:", *proxy)
+func proxyStart() {
+ log.Println("HTTP proxy listening on:" + *proxy)
s := &http.Server{
Addr: *proxy,
- Handler: proxyHandler{sink},
+ Handler: proxyHandler{},
}
log.Println("HTTP proxy result:", s.ListenAndServe())
}