Просмотр исходного кода

fix: revert previous change on IsValid() function; add validation in getUoTConnection();

cty123 2 лет назад
Родитель
Сommit
7aeca33729
2 измененных файлов с 4 добавлено и 1 удалено
  1. 3 0
      app/proxyman/outbound/uot.go
  2. 1 1
      common/net/destination.go

+ 3 - 0
app/proxyman/outbound/uot.go

@@ -11,6 +11,9 @@ import (
 )
 
 func (h *Handler) getUoTConnection(ctx context.Context, dest net.Destination) (stat.Connection, error) {
+	if dest.Address == nil {
+		return nil, newError("nil destination address")
+	}
 	if !dest.Address.Family().IsDomain() {
 		return nil, os.ErrInvalid
 	}

+ 1 - 1
common/net/destination.go

@@ -113,7 +113,7 @@ func (d Destination) String() string {
 
 // IsValid returns true if this Destination is valid.
 func (d Destination) IsValid() bool {
-	return d.Address != nil && d.Network != Network_Unknown
+	return d.Network != Network_Unknown
 }
 
 // AsDestination converts current Endpoint into Destination.