diff --git a/cmd/dns_proxy.go b/cmd/dns_proxy.go index 0ac7e5b..a878e84 100644 --- a/cmd/dns_proxy.go +++ b/cmd/dns_proxy.go @@ -19,9 +19,10 @@ func init() { var dnsProxyCmd = &cobra.Command{ Use: "dns-proxy [user@]host[:port]", - Short: "Starts a dns proxy", - Long: `Starts a local dns server that sends its request through the ssh tunnel + Short: "Starts a DNS over tcp proxy", + Long: `Starts a local DNS server that sends its request through the ssh tunnel to the configured DNS server. +It uses dns over TCP so the remote DNS serve must support TCP. `, Args: cobra.MinimumNArgs(1), Run: func(cmd *cobra.Command, args []string) { diff --git a/cmd/socks_proxy.go b/cmd/socks_proxy.go index 48ba7fb..14906c3 100644 --- a/cmd/socks_proxy.go +++ b/cmd/socks_proxy.go @@ -9,15 +9,15 @@ import ( ) func init() { - rootCmd.AddCommand(proxyCmd) + rootCmd.AddCommand(socksProxyCmd) // sshc options - cmnflags.AddSshClientFlags(proxyCmd.Flags()) + cmnflags.AddSshClientFlags(socksProxyCmd.Flags()) - proxyCmd.Flags().StringP("listen-address", "l", "127.0.0.1:1080", "the socks proxy listener address") + socksProxyCmd.Flags().StringP("listen-address", "l", "127.0.0.1:1080", "the socks proxy listener address") } -var proxyCmd = &cobra.Command{ - Use: "proxy [user@]host[:port]", +var socksProxyCmd = &cobra.Command{ + Use: "socks-proxy [user@]host[:port]", Short: "Starts a SOCKS proxy", Long: `Starts a SOCKS proxy diff --git a/pkg/sshc/dns_proxy.go b/pkg/sshc/dns_proxy.go index 401ef9a..7fd144a 100644 --- a/pkg/sshc/dns_proxy.go +++ b/pkg/sshc/dns_proxy.go @@ -38,6 +38,8 @@ func (p *DnsProxy) resolveDomain(conn net.Conn, msg *dns.Msg) ([]byte, error) { return nil, fmt.Errorf("failed to pack DNS message: %v", err) } + // dns over TCP requires the queryLength info to be written + // before the query queryLength := make([]byte, 2) binary.BigEndian.PutUint16(queryLength, uint16(len(query)))