review feedback

This commit is contained in:
Quentin McGaw
2026-06-05 05:01:18 +00:00
parent c18c54c3b7
commit b48ba8cb0a
2 changed files with 14 additions and 2 deletions
+2 -1
View File
@@ -2,6 +2,7 @@ package iptables
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
"io" "io"
"net/netip" "net/netip"
@@ -181,7 +182,7 @@ func (c *Config) AcceptOutputFromIPPortToIPPort(ctx context.Context,
protocol, intf string, source, destination netip.AddrPort, remove bool, protocol, intf string, source, destination netip.AddrPort, remove bool,
) error { ) error {
if source.Addr().BitLen() != destination.Addr().BitLen() { if source.Addr().BitLen() != destination.Addr().BitLen() {
return fmt.Errorf("source and destination address families do not match") return errors.New("source and destination address families do not match")
} }
interfaceFlag := "-o " + intf interfaceFlag := "-o " + intf
+12 -1
View File
@@ -69,12 +69,23 @@ func newHTTPSClient(destinationTLSName string, connection net.Conn) *http.Client
httpTransport.Proxy = nil httpTransport.Proxy = nil
httpTransport.MaxIdleConns = 1 httpTransport.MaxIdleConns = 1
httpTransport.MaxIdleConnsPerHost = 1 httpTransport.MaxIdleConnsPerHost = 1
httpTransport.MaxConnsPerHost = 1
httpTransport.IdleConnTimeout = time.Second httpTransport.IdleConnTimeout = time.Second
httpTransport.TLSClientConfig = &tls.Config{ httpTransport.TLSClientConfig = &tls.Config{
MinVersion: tls.VersionTLS12, MinVersion: tls.VersionTLS12,
ServerName: destinationTLSName, ServerName: destinationTLSName,
} }
httpTransport.DialContext = func(_ context.Context, _, _ string) (net.Conn, error) {
expectedAddress := net.JoinHostPort(destinationTLSName, "443")
httpTransport.DialContext = func(_ context.Context, network, address string) (net.Conn, error) {
switch network {
case "tcp", "tcp4", "tcp6":
default:
return nil, fmt.Errorf("unexpected dial network %q", network)
}
if address != expectedAddress {
return nil, fmt.Errorf("unexpected dial address %q (expected %q)", address, expectedAddress)
}
return connection, nil return connection, nil
} }