Skip to content

Send UDP ASSOCIATE command, DST.ADDR and DST.PORT should use zeros. #15

@Laitr0n

Description

@Laitr0n

Describe actual behavior

When request the udp association command, the dst.addr and dst.port is set the destination address and the destination port.

What is your expected behavior

If the client is not in possesion of the information at the time of the UDP ASSOCIATE, the client MUST use a port number and address of all zeros. Come from the describe of UDP ASSOCIATE in rfc-1928

Specifications like the version of the project, operating system, or hardware

Steps to reproduce the problem

package main

import (
	"fmt"

	"github.com/txthinking/socks5"
)

func main() {
	server := "xxx"
	username := "xxx"
	password := "xxx"
	tcpTimeout := 10
	udpTimeout := 60

	client, err := socks5.NewClient(server, username, password, tcpTimeout, udpTimeout)
	if err != nil {
		return
	}

	network := "udp"
	addr := "xxx"
	conn, _ := client.Dial(network, addr)
	_, err = conn.Write([]byte("hello"))
	if err != nil {
		return
	}
	udpResp := make([]byte, 1024)

	_, err = conn.Read(udpResp)
	if err != nil {
		fmt.Println("Error receiving UDP data:", err)
		return
	}
	fmt.Println(udpResp)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions