Fix socksaddr writer

This commit is contained in:
世界 2022-08-04 10:35:57 +08:00
parent d9ca259bec
commit 9c64b40e70
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -45,15 +45,15 @@ func NewSerializer(options ...SerializerOption) *Serializer {
}
func (s *Serializer) WriteAddress(writer io.Writer, addr Socksaddr) error {
var family Family
var af Family
if addr.IsIPv4() {
family = AddressFamilyIPv4
af = AddressFamilyIPv4
} else if addr.IsIPv6() {
family = AddressFamilyIPv6
af = AddressFamilyIPv6
} else {
family = AddressFamilyFqdn
af = AddressFamilyFqdn
}
err := rw.WriteByte(writer, family)
err := rw.WriteByte(writer, s.familyByteMap[af])
if err != nil {
return err
}