Package org.drasyl.peer
Class Endpoint
- java.lang.Object
-
- org.drasyl.peer.Endpoint
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getHost()
Returns the hostname of this endpoint.Integer
getNetworkId()
Returns the network id of this endpoint.int
getPort()
Returns the port of this endpoint.CompressedPublicKey
getPublicKey()
Returns theCompressedPublicKey
of thisEndpoint
.URI
getURI()
Returns anURI
representing thisEndpoint
.int
hashCode()
static Endpoint
of(String endpoint)
Converts aString
into anEndpoint
.static Endpoint
of(String host, int port, CompressedPublicKey publicKey)
Converts the givenhost
,port
, andpublicKey
into anEndpoint
.static Endpoint
of(String host, int port, CompressedPublicKey publicKey, Integer networkId)
Converts the givenhost
,port
,publicKey
, andnetworkId
into anEndpoint
.static Endpoint
of(URI endpoint)
Converts anURI
into anEndpoint
.String
toString()
-
-
-
Method Detail
-
getURI
public URI getURI()
Returns anURI
representing thisEndpoint
.- Returns:
- The
URI
representing thisEndpoint
. - Throws:
IllegalArgumentException
- If the createdURI
violates RFC 2396
-
getHost
public String getHost()
Returns the hostname of this endpoint.- Returns:
- The hostname of this endpoint.
-
getPort
public int getPort()
Returns the port of this endpoint.- Returns:
- The port of this endpoint
-
getPublicKey
public CompressedPublicKey getPublicKey()
Returns theCompressedPublicKey
of thisEndpoint
.- Returns:
- The public key of this endpoint.
-
getNetworkId
public Integer getNetworkId()
Returns the network id of this endpoint.- Returns:
- The network id of this endpoint
-
of
public static Endpoint of(String host, int port, CompressedPublicKey publicKey, Integer networkId)
Converts the givenhost
,port
,publicKey
, andnetworkId
into anEndpoint
.- Parameters:
host
- the hostname part of the endpointport
- the port number of the endpointpublicKey
- the public key of the endpointnetworkId
- the network id of the endpoint- Returns:
Endpoint
converted fromendpoint
- Throws:
NullPointerException
- ifendpoint
isnull
or contains no public keyIllegalArgumentException
- ifhost
,port
, andpublicKey
creates an invalidEndpoint
-
of
public static Endpoint of(String host, int port, CompressedPublicKey publicKey)
Converts the givenhost
,port
, andpublicKey
into anEndpoint
.- Parameters:
host
- the hostname part of the endpointport
- the port number of the endpointpublicKey
- the public key of the endpoint- Returns:
Endpoint
converted fromendpoint
- Throws:
NullPointerException
- ifendpoint
isnull
or contains no public keyIllegalArgumentException
- ifhost
,port
, andpublicKey
creates an invalidEndpoint
-
of
public static Endpoint of(URI endpoint)
Converts anURI
into anEndpoint
.- Parameters:
endpoint
- a drasyl node endpoint represented asURI
- Returns:
Endpoint
converted fromendpoint
- Throws:
NullPointerException
- ifendpoint
isnull
or contains no public keyIllegalArgumentException
- ifendpoint
creates an invalidEndpoint
-
of
public static Endpoint of(String endpoint)
Converts aString
into anEndpoint
.- Parameters:
endpoint
- a drasyl node endpoint represented asURI
- Returns:
Endpoint
converted fromendpoint
- Throws:
NullPointerException
- ifendpoint
isnull
IllegalArgumentException
- ifendpoint
creates an invalidEndpoint
-
-