mirror of
https://github.com/qdm12/gluetun.git
synced 2026-06-25 21:37:31 +02:00
moare fixes
This commit is contained in:
@@ -23,7 +23,10 @@ type Client struct {
|
|||||||
|
|
||||||
func New(firewall Firewall, defaultInterface string, ipv6Supported bool,
|
func New(firewall Firewall, defaultInterface string, ipv6Supported bool,
|
||||||
upstreamResolvers []provider.Provider,
|
upstreamResolvers []provider.Provider,
|
||||||
) (*Client, error) {
|
) *Client {
|
||||||
|
if len(upstreamResolvers) == 0 {
|
||||||
|
panic("no upstream resolvers provided") // programming error
|
||||||
|
}
|
||||||
dohServers := make([]provider.DoHServer, len(upstreamResolvers))
|
dohServers := make([]provider.DoHServer, len(upstreamResolvers))
|
||||||
for i, upstreamResolver := range upstreamResolvers {
|
for i, upstreamResolver := range upstreamResolvers {
|
||||||
dohServers[i] = upstreamResolver.DoH
|
dohServers[i] = upstreamResolver.DoH
|
||||||
@@ -36,7 +39,7 @@ func New(firewall Firewall, defaultInterface string, ipv6Supported bool,
|
|||||||
ipv6Supported: ipv6Supported,
|
ipv6Supported: ipv6Supported,
|
||||||
dohServers: dohServers,
|
dohServers: dohServers,
|
||||||
httpsPort: defaultHTTPSPort,
|
httpsPort: defaultHTTPSPort,
|
||||||
}, nil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) OpenHTTPSByDomain(ctx context.Context, domain string) (
|
func (c *Client) OpenHTTPSByDomain(ctx context.Context, domain string) (
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ func (c *Client) OpenHTTPS(ctx context.Context, destinationTLSName string, desti
|
|||||||
connection, err := connectSourceConnection(ctx, fd, destinationAddrPort)
|
connection, err := connectSourceConnection(ctx, fd, destinationAddrPort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
const remove = true
|
const remove = true
|
||||||
_ = c.firewall.AcceptOutputFromIPPortToIPPort(ctx, "tcp", c.outboundInterface,
|
_ = c.firewall.AcceptOutputFromIPPortToIPPort(context.Background(), "tcp", c.outboundInterface,
|
||||||
sourceAddrPort, destinationAddrPort, remove)
|
sourceAddrPort, destinationAddrPort, remove)
|
||||||
return nil, nil, fmt.Errorf("connecting source socket: %w", err)
|
return nil, nil, fmt.Errorf("connecting source socket: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user