From 9c64b40e705090aa4ae7cc62fe87f76c89de3e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Thu, 4 Aug 2022 10:35:57 +0800 Subject: [PATCH] Fix socksaddr writer --- common/metadata/serializer.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/metadata/serializer.go b/common/metadata/serializer.go index 136a662..fbecd88 100644 --- a/common/metadata/serializer.go +++ b/common/metadata/serializer.go @@ -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 }