net.i2p.router.tunnel.pool

## Class ConnectChecker

- java.lang.Object
- - net.i2p.router.tunnel.pool.ConnectChecker

- Direct Known Subclasses:
    TunnelPeerSelector

      public class ConnectChecker
      extends Object

  Tools to check transport compatibility.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `ANY_V4`
    `protected RouterContext` | `ctx`
    `protected Log` | `log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConnectChecker(RouterContext context)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canConnect(Hash from, Hash to)` Can "from" connect to "to" based on published addresses? This is intended for tunnel candidates, where we already have the RI.
    `boolean` | `canConnect(int ourMask, RouterInfo to)` Can we connect to "to" based on published addresses? This is intended for tunnel candidates, where we already have the RI.
    `boolean` | `canConnect(RouterInfo from, int ourMask)` Can "from" connect to us based on published addresses? This is intended for tunnel candidates, where we already have the RI.
    `int` | `getInboundMask(RouterInfo us)` Our inbound mask.
    `int` | `getOutboundMask(RouterInfo us)` Our outbound mask.
    `protected boolean` | `isNTCPDisabled()` Is NTCP disabled?
    `protected boolean` | `isSSUDisabled()` Is SSU disabled?

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ANY_V4

          public static final int ANY_V4

      See Also:
        Constant Field Values

    - #### ctx

          protected final RouterContext ctx

    - #### log

          protected final Log log

  - ### Constructor Detail

    - #### ConnectChecker

          public ConnectChecker(RouterContext context)

  - ### Method Detail

    - #### canConnect

          public boolean canConnect(Hash from,
                                    Hash to)

      Can "from" connect to "to" based on published addresses? This is intended for tunnel candidates, where we already have the RI. Will not force RI lookups. Either from or to may be us. This is best effort, as we can't know for sure. Published addresses or introducers may have changed. Even if a can't connect to b, they may already be connected as b connected to a.
      Returns:
        true if we don't have either RI

    - #### canConnect

          public boolean canConnect(int ourMask,
                                    RouterInfo to)

      Can we connect to "to" based on published addresses? This is intended for tunnel candidates, where we already have the RI. Will not force RI lookups. This is best effort, as we can't know for sure. Does not check isEstablished(); do that first.

    - #### canConnect

          public boolean canConnect(RouterInfo from,
                                    int ourMask)

      Can "from" connect to us based on published addresses? This is intended for tunnel candidates, where we already have the RI. Will not force RI lookups. This is best effort, as we can't know for sure. Does not check isEstablished(); do that first.

    - #### getInboundMask

          public int getInboundMask(RouterInfo us)

      Our inbound mask. For most cases, we use what we published, i.e. getConnectMask()
      Returns:
        bitmask for accepting connections

    - #### getOutboundMask

          public int getOutboundMask(RouterInfo us)

      Our outbound mask. For most cases, we use our comm system status.
      Returns:
        bitmask for initiating connections

    - #### isNTCPDisabled

          protected boolean isNTCPDisabled()

      Is NTCP disabled?

    - #### isSSUDisabled

          protected boolean isSSUDisabled()

      Is SSU disabled?