<PackageReference Include="System.Security.Permissions" Version="9.0.6" />

EndpointPermission

public class EndpointPermission
Defines an endpoint that is authorized by a SocketPermission instance.
public string Hostname { get; }

Gets the DNS host name or IP address of the server that is associated with this endpoint.

public int Port { get; }

Gets the network port number that is associated with this endpoint.

public TransportType Transport { get; }

Gets the transport type that is associated with this endpoint.