mirror of
https://github.com/qdm12/gluetun.git
synced 2025-12-10 20:07:32 -06:00
- Faster start up - Clearer error messages - Allow for more Gluetun-specific customization - DNSSEC validation is dropped for now (it's sort of unneeded) - Fix #137
34 lines
876 B
Go
34 lines
876 B
Go
package server
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/qdm12/gluetun/internal/httpserver"
|
|
"github.com/qdm12/gluetun/internal/models"
|
|
)
|
|
|
|
func New(ctx context.Context, address string, logEnabled bool, logger Logger,
|
|
buildInfo models.BuildInformation, openvpnLooper VPNLooper,
|
|
pfGetter PortForwardedGetter, dnsLooper DNSLoop,
|
|
updaterLooper UpdaterLooper, publicIPLooper PublicIPLoop, storage Storage,
|
|
ipv6Supported bool) (
|
|
server *httpserver.Server, err error) {
|
|
handler := newHandler(ctx, logger, logEnabled, buildInfo,
|
|
openvpnLooper, pfGetter, dnsLooper, updaterLooper, publicIPLooper,
|
|
storage, ipv6Supported)
|
|
|
|
httpServerSettings := httpserver.Settings{
|
|
Address: address,
|
|
Handler: handler,
|
|
Logger: logger,
|
|
}
|
|
|
|
server, err = httpserver.New(httpServerSettings)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("creating server: %w", err)
|
|
}
|
|
|
|
return server, nil
|
|
}
|