mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-22 23:13:01 +00:00
Socks4a server: Check if the client sends an IP address as domain (#3628)
Fixes https://github.com/XTLS/Xray-core/issues/3622
This commit is contained in:
parent
7e24239c9a
commit
644901d1a5
@ -121,6 +121,11 @@ func IPAddress(ip []byte) Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DomainAddress creates an Address with given domain.
|
// DomainAddress creates an Address with given domain.
|
||||||
|
// This is an internal function that forcibly converts a string to domain.
|
||||||
|
// It's mainly used in test files and mux.
|
||||||
|
// Unless you have a specific reason, use net.ParseAddress instead,
|
||||||
|
// as this function does not check whether the input is an IP address.
|
||||||
|
// Otherwise, you will get strange results like domain: 1.1.1.1
|
||||||
func DomainAddress(domain string) Address {
|
func DomainAddress(domain string) Address {
|
||||||
return domainAddress(domain)
|
return domainAddress(domain)
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ func (s *ServerSession) handshake4(cmd byte, reader io.Reader, writer io.Writer)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.New("failed to read domain for socks 4a").Base(err)
|
return nil, errors.New("failed to read domain for socks 4a").Base(err)
|
||||||
}
|
}
|
||||||
address = net.DomainAddress(domain)
|
address = net.ParseAddress(domain)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch cmd {
|
switch cmd {
|
||||||
|
Loading…
Reference in New Issue
Block a user