trpc.group/trpc-go/trpc-go@v1.0.3/internal/addrutil/addrutil.go (about)

     1  // Package addrutil provides some utility functions for net address.
     2  package addrutil
     3  
     4  import (
     5  	"net"
     6  	"strings"
     7  )
     8  
     9  // AddrToKey combines local and remote address into a string.
    10  func AddrToKey(local, remote net.Addr) string {
    11  	return strings.Join([]string{local.Network(), local.String(), remote.String()}, "_")
    12  }