Class CreateTunnel


  • public class CreateTunnel
    extends java.lang.Object
    An object that represents a ngrok Tunnel creation request. This object can be serialized and passed to the HttpClient.

    Basic Usage

     final NgrokClient ngrokClient = new NgrokClient.Builder().build();
    
     final CreateTunnel createTunnel = new CreateTunnel.Builder()
             .withName("my-tunnel")
             .withProto(Proto.TCP)
             .withAddr(5000)
             .build();
    
     final HttpClient httpClient = new DefaultHttpClient.Builder().build()
     final Response<SomePOJOResponse> postResponse = httpClient.post("http://localhost:4040/api/tunnels",
                                                                     createTunnel,
                                                                     Tunnel.class);
     

    ngrok Version Compatibility

    java-ngrok is compatible with ngrok v2 and v3, but by default it will install v3. To install v2 instead, set the version with JavaNgrokConfig.Builder.withNgrokVersion(NgrokVersion) and CreateTunnel.Builder.withNgrokVersion(NgrokVersion).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAddr()
      Get the local port to which the tunnel will forward traffic.
      java.lang.String getAuth()
      Get HTTP basic authentication credentials enforced on tunnel requests.
      java.util.List<java.lang.String> getBasicAuth()
      Get the list of HTTP basic authentication credentials to enforce on tunneled requests.
      BindTls getBindTls()
      Get ngrok's bind_tls value.
      java.lang.Float getCircuitBreaker()
      Get the circuit breaker trigger.
      java.lang.String getClientCas()
      Get the PEM TLS certificate authority path that will be used to verify incoming TLS client connection certificates.
      java.lang.String getCrt()
      Get the PEM TLS certificate path that will be used to terminate TLS traffic before forwarding locally.
      java.lang.String getHostHeader()
      Get the HTTP Host header.
      java.lang.String getHostname()
      Get the hostname.
      TunnelIPRestrictions getIpRestrictions()
      Get the IP restrictions for the tunnel.
      java.lang.String getKey()
      Get the PEM TLS private key path that will be used to terminate TLS traffic before forwarding locally.
      java.util.List<java.lang.String> getLabels()
      Get the labels.
      java.lang.String getMetadata()
      Get the arbitrary user-defined metadata that will appear in the ngrok service API when listing tunnels.
      java.lang.String getMutualTlsCas()
      Get the path to the TLS certificate authority to verify client certs.
      java.lang.String getName()
      Get the name of the tunnel.
      NgrokVersion getNgrokVersion()
      Get the version of ngrok for which the tunnel was created.
      TunnelOAuth getOauth()
      Get the OAuth settings to be setup on the tunnel.
      Proto getProto()
      Get the tunnel protocol.
      java.lang.String getProxyProto()
      Get the proxy proto.
      java.lang.String getRemoteAddr()
      Get the bound remote TCP port on the given address.
      TunnelHeader getRequestHeader()
      Get the Headers to be added or removed from requests.
      TunnelHeader getResponseHeader()
      Get the Headers to be added or removed from responses.
      java.util.List<java.lang.String> getSchemes()
      Get the schemes to be bound.
      java.lang.String getSubdomain()
      Get the subdomain.
      java.lang.String getTerminateAt()
      Get the termination point.
      TunnelVerifyWebhook getVerifyWebhook()
      Get the signature for webhooks.
      java.lang.Boolean isCompression()
      Whether compression is enabled on this tunnel.
      java.lang.Boolean isInspect()
      Whether HTTP request inspection on tunnels is enabled.
      java.lang.Boolean isWebsocketTcpConverter()
      Whether ingress connections are converted to TCP upstream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getNgrokVersion

        public NgrokVersion getNgrokVersion()
        Get the version of ngrok for which the tunnel was created.
      • getName

        public java.lang.String getName()
        Get the name of the tunnel.
      • getProto

        public Proto getProto()
        Get the tunnel protocol.
      • getAddr

        public java.lang.String getAddr()
        Get the local port to which the tunnel will forward traffic.
      • isInspect

        public java.lang.Boolean isInspect()
        Whether HTTP request inspection on tunnels is enabled.
      • getAuth

        public java.lang.String getAuth()
        Get HTTP basic authentication credentials enforced on tunnel requests.
      • getHostHeader

        public java.lang.String getHostHeader()
        Get the HTTP Host header.
      • getBindTls

        public BindTls getBindTls()
        Get ngrok's bind_tls value.
      • getSubdomain

        public java.lang.String getSubdomain()
        Get the subdomain.
      • getHostname

        public java.lang.String getHostname()
        Get the hostname.
      • getCrt

        public java.lang.String getCrt()
        Get the PEM TLS certificate path that will be used to terminate TLS traffic before forwarding locally.
      • getKey

        public java.lang.String getKey()
        Get the PEM TLS private key path that will be used to terminate TLS traffic before forwarding locally.
      • getClientCas

        public java.lang.String getClientCas()
        Get the PEM TLS certificate authority path that will be used to verify incoming TLS client connection certificates.
      • getRemoteAddr

        public java.lang.String getRemoteAddr()
        Get the bound remote TCP port on the given address.
      • getMetadata

        public java.lang.String getMetadata()
        Get the arbitrary user-defined metadata that will appear in the ngrok service API when listing tunnels.
      • getSchemes

        public java.util.List<java.lang.String> getSchemes()
        Get the schemes to be bound.
      • getBasicAuth

        public java.util.List<java.lang.String> getBasicAuth()
        Get the list of HTTP basic authentication credentials to enforce on tunneled requests.
      • getOauth

        public TunnelOAuth getOauth()
        Get the OAuth settings to be setup on the tunnel.
      • getCircuitBreaker

        public java.lang.Float getCircuitBreaker()
        Get the circuit breaker trigger.
      • isCompression

        public java.lang.Boolean isCompression()
        Whether compression is enabled on this tunnel.
      • getMutualTlsCas

        public java.lang.String getMutualTlsCas()
        Get the path to the TLS certificate authority to verify client certs.
      • getProxyProto

        public java.lang.String getProxyProto()
        Get the proxy proto.
      • isWebsocketTcpConverter

        public java.lang.Boolean isWebsocketTcpConverter()
        Whether ingress connections are converted to TCP upstream.
      • getTerminateAt

        public java.lang.String getTerminateAt()
        Get the termination point.
      • getRequestHeader

        public TunnelHeader getRequestHeader()
        Get the Headers to be added or removed from requests.
      • getResponseHeader

        public TunnelHeader getResponseHeader()
        Get the Headers to be added or removed from responses.
      • getIpRestrictions

        public TunnelIPRestrictions getIpRestrictions()
        Get the IP restrictions for the tunnel.
      • getVerifyWebhook

        public TunnelVerifyWebhook getVerifyWebhook()
        Get the signature for webhooks.
      • getLabels

        public java.util.List<java.lang.String> getLabels()
        Get the labels.