mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-04 20:37:40 +03:00
Fix socksaddr writer
This commit is contained in:
parent
d9ca259bec
commit
9c64b40e70
1 changed files with 5 additions and 5 deletions
|
@ -45,15 +45,15 @@ func NewSerializer(options ...SerializerOption) *Serializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Serializer) WriteAddress(writer io.Writer, addr Socksaddr) error {
|
func (s *Serializer) WriteAddress(writer io.Writer, addr Socksaddr) error {
|
||||||
var family Family
|
var af Family
|
||||||
if addr.IsIPv4() {
|
if addr.IsIPv4() {
|
||||||
family = AddressFamilyIPv4
|
af = AddressFamilyIPv4
|
||||||
} else if addr.IsIPv6() {
|
} else if addr.IsIPv6() {
|
||||||
family = AddressFamilyIPv6
|
af = AddressFamilyIPv6
|
||||||
} else {
|
} else {
|
||||||
family = AddressFamilyFqdn
|
af = AddressFamilyFqdn
|
||||||
}
|
}
|
||||||
err := rw.WriteByte(writer, family)
|
err := rw.WriteByte(writer, s.familyByteMap[af])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue