readme: fix issue tracker link
This commit is contained in:
parent
dab2eb4449
commit
30dc7be08e
|
@ -28,4 +28,4 @@ MIT
|
||||||
[tlstunnel]: https://sr.ht/~emersion/tlstunnel/
|
[tlstunnel]: https://sr.ht/~emersion/tlstunnel/
|
||||||
[PROXY protocol]: https://www.haproxy.org/download/2.3/doc/proxy-protocol.txt
|
[PROXY protocol]: https://www.haproxy.org/download/2.3/doc/proxy-protocol.txt
|
||||||
[mailing list]: https://lists.sr.ht/~emersion/public-inbox
|
[mailing list]: https://lists.sr.ht/~emersion/public-inbox
|
||||||
[issue tracker]: https://git.sr.ht/~emersion/tlstunnel
|
[issue tracker]: https://todo.sr.ht/~emersion/tlstunnel
|
||||||
|
|
18
server.go
18
server.go
|
@ -15,6 +15,10 @@ import (
|
||||||
"github.com/pires/go-proxyproto/tlvparse"
|
"github.com/pires/go-proxyproto/tlvparse"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type conn struct {
|
||||||
|
downstream, upstream net.Conn
|
||||||
|
}
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
Listeners map[string]*Listener // indexed by listening address
|
Listeners map[string]*Listener // indexed by listening address
|
||||||
Frontends []*Frontend
|
Frontends []*Frontend
|
||||||
|
@ -24,6 +28,8 @@ type Server struct {
|
||||||
|
|
||||||
ACMEManager *certmagic.ACMEManager
|
ACMEManager *certmagic.ACMEManager
|
||||||
ACMEConfig *certmagic.Config
|
ACMEConfig *certmagic.Config
|
||||||
|
|
||||||
|
conns map[*conn]struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewServer() *Server {
|
func NewServer() *Server {
|
||||||
|
@ -76,10 +82,16 @@ func (srv *Server) Start() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (srv *Server) Close() error {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
type Listener struct {
|
type Listener struct {
|
||||||
Address string
|
Address string
|
||||||
Server *Server
|
Server *Server
|
||||||
Frontends map[string]*Frontend // indexed by server name
|
Frontends map[string]*Frontend // indexed by server name
|
||||||
|
|
||||||
|
ln net.Listener
|
||||||
}
|
}
|
||||||
|
|
||||||
func newListener(srv *Server, addr string) *Listener {
|
func newListener(srv *Server, addr string) *Listener {
|
||||||
|
@ -105,6 +117,8 @@ func (ln *Listener) Start() error {
|
||||||
}
|
}
|
||||||
log.Printf("listening on %q", ln.Address)
|
log.Printf("listening on %q", ln.Address)
|
||||||
|
|
||||||
|
ln.ln = netLn
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if err := ln.serve(netLn); err != nil {
|
if err := ln.serve(netLn); err != nil {
|
||||||
log.Fatalf("listener %q: %v", ln.Address, err)
|
log.Fatalf("listener %q: %v", ln.Address, err)
|
||||||
|
@ -114,6 +128,10 @@ func (ln *Listener) Start() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ln *Listener) Close() error {
|
||||||
|
return ln.ln.Close()
|
||||||
|
}
|
||||||
|
|
||||||
func (ln *Listener) serve(netLn net.Listener) error {
|
func (ln *Listener) serve(netLn net.Listener) error {
|
||||||
for {
|
for {
|
||||||
conn, err := netLn.Accept()
|
conn, err := netLn.Accept()
|
||||||
|
|
Loading…
Reference in New Issue