mirror of
https://github.com/dcarrillo/whatismyip.git
synced 2024-12-22 01:38:01 +00:00
Use pointers to proper server initializing handling
This commit is contained in:
parent
e60d1ae5b7
commit
8783db018b
@ -15,8 +15,8 @@ type QuicServer struct {
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func NewQuicServer(ctx context.Context, tlsServer *TLSServer) QuicServer {
|
||||
return QuicServer{
|
||||
func NewQuicServer(ctx context.Context, tlsServer *TLSServer) *QuicServer {
|
||||
return &QuicServer{
|
||||
tlsServer: tlsServer,
|
||||
ctx: ctx,
|
||||
}
|
||||
|
@ -24,9 +24,9 @@ type Factory struct {
|
||||
}
|
||||
|
||||
func Setup(ctx context.Context, handler http.Handler) *Factory {
|
||||
var tcpServer TCPServer
|
||||
var tlsServer TLSServer
|
||||
var quicServer QuicServer
|
||||
var tcpServer *TCPServer
|
||||
var tlsServer *TLSServer
|
||||
var quicServer *QuicServer
|
||||
|
||||
if setting.App.BindAddress != "" {
|
||||
tcpServer = NewTCPServer(ctx, &handler)
|
||||
@ -35,14 +35,14 @@ func Setup(ctx context.Context, handler http.Handler) *Factory {
|
||||
if setting.App.TLSAddress != "" {
|
||||
tlsServer = NewTLSServer(ctx, &handler)
|
||||
if setting.App.EnableHTTP3 {
|
||||
quicServer = NewQuicServer(ctx, &tlsServer)
|
||||
quicServer = NewQuicServer(ctx, tlsServer)
|
||||
}
|
||||
}
|
||||
|
||||
return &Factory{
|
||||
tcpServer: &tcpServer,
|
||||
tlsServer: &tlsServer,
|
||||
quicServer: &quicServer,
|
||||
tcpServer: tcpServer,
|
||||
tlsServer: tlsServer,
|
||||
quicServer: quicServer,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,8 @@ type TCPServer struct {
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func NewTCPServer(ctx context.Context, handler *http.Handler) TCPServer {
|
||||
return TCPServer{
|
||||
func NewTCPServer(ctx context.Context, handler *http.Handler) *TCPServer {
|
||||
return &TCPServer{
|
||||
handler: handler,
|
||||
ctx: ctx,
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ type TLSServer struct {
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func NewTLSServer(ctx context.Context, handler *http.Handler) TLSServer {
|
||||
return TLSServer{
|
||||
func NewTLSServer(ctx context.Context, handler *http.Handler) *TLSServer {
|
||||
return &TLSServer{
|
||||
handler: handler,
|
||||
ctx: ctx,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user