mirror of
https://github.com/qdm12/gluetun.git
synced 2026-06-25 13:27:31 +02:00
Minor fixes
This commit is contained in:
@@ -189,9 +189,9 @@ func (c *Config) AcceptOutputFromIPPortToIPPort(ctx context.Context,
|
|||||||
interfaceFlag = ""
|
interfaceFlag = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
instruction := fmt.Sprintf("%s OUTPUT -s %s --sport %d -d %s %s -p %s -m %s --dport %d -j ACCEPT",
|
instruction := fmt.Sprintf("%s OUTPUT %s -s %s -d %s -p %s -m %s --sport %d --dport %d -j ACCEPT",
|
||||||
appendOrDelete(remove), source.Addr(), source.Port(), destination.Addr(),
|
appendOrDelete(remove), interfaceFlag, source.Addr(), destination.Addr(),
|
||||||
interfaceFlag, protocol, protocol, destination.Port())
|
protocol, protocol, source.Port(), destination.Port())
|
||||||
if destination.Addr().Is4() {
|
if destination.Addr().Is4() {
|
||||||
return c.runIptablesInstruction(ctx, instruction)
|
return c.runIptablesInstruction(ctx, instruction)
|
||||||
} else if c.ip6Tables == "" {
|
} else if c.ip6Tables == "" {
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ import (
|
|||||||
func (c *Client) ResolveName(ctx context.Context, host string) (
|
func (c *Client) ResolveName(ctx context.Context, host string) (
|
||||||
resolvedAddresses []netip.Addr, err error,
|
resolvedAddresses []netip.Addr, err error,
|
||||||
) {
|
) {
|
||||||
questionTypes := make([]uint16, 0, 2)
|
const maxTypes = 2
|
||||||
|
questionTypes := make([]uint16, 0, maxTypes)
|
||||||
if c.ipv6Supported {
|
if c.ipv6Supported {
|
||||||
questionTypes = append(questionTypes, dns.TypeAAAA)
|
questionTypes = append(questionTypes, dns.TypeAAAA)
|
||||||
}
|
}
|
||||||
@@ -105,12 +106,12 @@ func (c *Client) resolveOneQuestionType(ctx context.Context,
|
|||||||
func (c *Client) doHQuery(ctx context.Context, queryWire []byte,
|
func (c *Client) doHQuery(ctx context.Context, queryWire []byte,
|
||||||
dohURL *url.URL, dohServerIP netip.Addr,
|
dohURL *url.URL, dohServerIP netip.Addr,
|
||||||
) (responseMessage *dns.Msg, err error) {
|
) (responseMessage *dns.Msg, err error) {
|
||||||
httpClient, close, err := c.OpenHTTPS(dohURL.Hostname(), dohServerIP)
|
httpClient, cleanup, err := c.OpenHTTPS(dohURL.Hostname(), dohServerIP)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("opening https connection: %w", err)
|
return nil, fmt.Errorf("opening https connection: %w", err)
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
closeErr := close()
|
closeErr := cleanup()
|
||||||
if err == nil && closeErr != nil {
|
if err == nil && closeErr != nil {
|
||||||
err = fmt.Errorf("cleaning up https connection: %w", closeErr)
|
err = fmt.Errorf("cleaning up https connection: %w", closeErr)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ func Test_answersToNetipAddrs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for testName, testCase := range testCases {
|
for testName, testCase := range testCases {
|
||||||
testCase := testCase
|
|
||||||
t.Run(testName, func(t *testing.T) {
|
t.Run(testName, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user