mirror of
https://github.com/jpillora/chisel
synced 2024-10-18 16:02:19 +00:00
Support direct control of the server listener
This commit is contained in:
parent
92d90be68a
commit
40f4251371
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
|
@ -30,6 +31,8 @@ type Config struct {
|
|||
Reverse bool
|
||||
KeepAlive time.Duration
|
||||
TLS TLSConfig
|
||||
|
||||
Listener net.Listener
|
||||
}
|
||||
|
||||
// Server respresent a chisel service
|
||||
|
|
|
@ -23,6 +23,10 @@ type TLSConfig struct {
|
|||
}
|
||||
|
||||
func (s *Server) listener(host, port string) (net.Listener, error) {
|
||||
if s.config.Listener != nil {
|
||||
return s.config.Listener, nil
|
||||
}
|
||||
|
||||
hasDomains := len(s.config.TLS.Domains) > 0
|
||||
hasKeyCert := s.config.TLS.Key != "" && s.config.TLS.Cert != ""
|
||||
if hasDomains && hasKeyCert {
|
||||
|
|
Loading…
Reference in a new issue