Browse Source

add address type classification function

Shelikhoo 3 years ago
parent
commit
409c4e9c98
1 changed files with 12 additions and 0 deletions
  1. 12 0
      common/net/packetaddr/connection_adaptor.go

+ 12 - 0
common/net/packetaddr/connection_adaptor.go

@@ -139,3 +139,15 @@ func (pc *packetConnWrapper) Write(p []byte) (n int, err error) {
 func (pc *packetConnWrapper) Close() error {
 func (pc *packetConnWrapper) Close() error {
 	return pc.Close()
 	return pc.Close()
 }
 }
+
+func GetDestinationSubsetOf(dest net.Destination) (bool, error) {
+	if !dest.Address.Family().IsDomain() {
+		return false, errNotPacketConn
+	}
+	switch dest.Address.Domain() {
+	case seqPacketMagicAddress:
+		return false, nil
+	default:
+		return false, errNotPacketConn
+	}
+}