forked from Ivasoft/traefik
UDP support
Co-authored-by: Julien Salleyron <julien.salleyron@gmail.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
type Server struct {
|
||||
watcher *ConfigurationWatcher
|
||||
tcpEntryPoints TCPEntryPoints
|
||||
udpEntryPoints UDPEntryPoints
|
||||
chainBuilder *middleware.ChainBuilder
|
||||
|
||||
accessLoggerMiddleware *accesslog.Handler
|
||||
@@ -28,7 +29,7 @@ type Server struct {
|
||||
}
|
||||
|
||||
// NewServer returns an initialized Server.
|
||||
func NewServer(routinesPool *safe.Pool, entryPoints TCPEntryPoints, watcher *ConfigurationWatcher,
|
||||
func NewServer(routinesPool *safe.Pool, entryPoints TCPEntryPoints, entryPointsUDP UDPEntryPoints, watcher *ConfigurationWatcher,
|
||||
chainBuilder *middleware.ChainBuilder, accessLoggerMiddleware *accesslog.Handler) *Server {
|
||||
srv := &Server{
|
||||
watcher: watcher,
|
||||
@@ -38,6 +39,7 @@ func NewServer(routinesPool *safe.Pool, entryPoints TCPEntryPoints, watcher *Con
|
||||
signals: make(chan os.Signal, 1),
|
||||
stopChan: make(chan bool, 1),
|
||||
routinesPool: routinesPool,
|
||||
udpEntryPoints: entryPointsUDP,
|
||||
}
|
||||
|
||||
srv.configureSignals()
|
||||
@@ -56,6 +58,7 @@ func (s *Server) Start(ctx context.Context) {
|
||||
}()
|
||||
|
||||
s.tcpEntryPoints.Start()
|
||||
s.udpEntryPoints.Start()
|
||||
s.watcher.Start()
|
||||
|
||||
s.routinesPool.GoCtx(s.listenSignals)
|
||||
@@ -71,6 +74,7 @@ func (s *Server) Stop() {
|
||||
defer log.WithoutContext().Info("Server stopped")
|
||||
|
||||
s.tcpEntryPoints.Stop()
|
||||
s.udpEntryPoints.Stop()
|
||||
|
||||
s.stopChan <- true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user