Skip to content

Ingress plugins ​

An ingress plugin provides a new way to make apps reachable, in addition to regular domains. The Tor plugin, for example, makes apps available as Tor onion services.

How it works ​

  1. When n5i loads an app, it calls SupportsPlugin of every ingress plugin with the app's ingress configuration. A plugin that can handle it returns one or more options, which the user can pick from.
  2. When the user adds a domain with one of these options, n5i calls AddDomain. The plugin sets up the ingress (for example, creates an onion service) and returns the domain it created or accepted.
  3. When the user removes the domain, n5i calls RemoveDomain.

Set can_choose_domain if the user enters the domain, with domain_placeholder as input placeholder; otherwise the plugin picks it.

RPC interface ​

proto
syntax = "proto3";

package n5i_plugin;
import "common.proto";

// This is what the app declares as ingress type, a plugin ingress implementation may handle it differently
enum IngressType {
  HTTP_FALLBACK = 0;
  HTTPS = 1;
  TLS_TCP = 2;
}

message Ingress {
  optional string target_service = 1;
  optional string target_ns = 2;
  optional string target_app = 3;
  optional string path_prefix = 4;
  optional uint32 target_port = 5;
  IngressType type = 6;

  bool enable_compression = 7;
  bool strip_prefix = 8;
  bool auth_exclude = 9;

  bool use_https = 10 [deprecated = true];
  bool tls_insecure = 11;
  optional string use_https_with_hostname = 12; // If set, use this hostname for TLS SNI instead of the domain being accessed
}


message SupportCheckRequest {
  repeated Ingress app_ingress_config = 1;
}

message IngressOption {
  string id = 1; // Unique identifier for the ingress option, used later when adding  domains
  // The name, in a map language -> name
  map<string, string> name = 2;
  bool can_choose_domain = 3;
  map<string, string> domain_placeholder = 4; // If can_choose_domain is true, this is the placeholder for the domain input, in a map language -> placeholder
}

message SupportCheckResponse {
  bool supported = 1;
  repeated IngressOption options = 2;
}

message AddDomainRequest {
  string app_id = 1;
  string user_id = 2;
  repeated Ingress ingress = 3;
  optional string chosen_domain = 4;
  bool protect = 5;
  optional string custom_prefix = 6;
  AppScope scope = 7;
  string option_id = 8; // The option the user chose to add this domain
}

message AddDomainResponse {
  string domain = 1;
}

message RemoveDomainRequest {
  string app_id = 1;
  string user_id = 2;
  string domain = 3;
  AppScope scope = 4;
  string option_id = 5; // The option the user chose to add this domain
}

message RemoveDomainResponse {}

service IngressPlugin {
  rpc SupportsPlugin(SupportCheckRequest) returns (SupportCheckResponse) {}

  rpc AddDomain(AddDomainRequest) returns (AddDomainResponse) {}
  rpc RemoveDomain(RemoveDomainRequest) returns (RemoveDomainResponse) {}
}

Free and open-source software under the GNU AGPL 3.0 or later.