I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit ce5acb49 authored by zzz's avatar zzz
Browse files

add some convenience methods

parent 4822e471
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,27 @@ public interface TunnelInfo {
/** retrieve the peer at the given hop. the gateway is hop 0 */
public Hash getPeer(int hop);
/**
* For convenience
* @return getPeer(0)
* @since 0.8.9
*/
public Hash getGateway();
/**
* For convenience
* @return getPeer(getLength() - 1)
* @since 0.8.9
*/
public Hash getEndpoint();
/**
* For convenience
* @return isInbound() ? getGateway() : getEndpoint()
* @since 0.8.9
*/
public Hash getFarEnd();
/** is this an inbound tunnel? */
public boolean isInbound();
......
......@@ -81,6 +81,33 @@ public class TunnelCreatorConfig implements TunnelInfo {
public Hash getPeer(int hop) { return _peers[hop]; }
public void setPeer(int hop, Hash peer) { _peers[hop] = peer; }
/**
* For convenience
* @return getPeer(0)
* @since 0.8.9
*/
public Hash getGateway() {
return _peers[0];
}
/**
* For convenience
* @return getPeer(getLength() - 1)
* @since 0.8.9
*/
public Hash getEndpoint() {
return _peers[_peers.length - 1];
}
/**
* For convenience
* @return isInbound() ? getGateway() : getEndpoint()
* @since 0.8.9
*/
public Hash getFarEnd() {
return _peers[_isInbound ? 0 : _peers.length - 1];
}
/** is this an inbound tunnel? */
public boolean isInbound() { return _isInbound; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment