"Fossies" - the Fresh Open Source Software Archive

Member "wire-server-2021-11-15/libs/wire-api-federation/proto/router.proto" (16 Nov 2021, 3136 Bytes) of package /linux/misc/wire-server-2021-11-15.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "router.proto": 2021-09-08_vs_2021-09-14.

    1 syntax = "proto3";
    2 package wire.federator;
    3 
    4 // These definitions are part of the federation protocol.
    5 //
    6 // 1. A component (e.g. 'brig') will send some data of type 'FederatedRequest' to
    7 // the 'federator' server (more precisely: the 'Outward' service part of the federator) within a same private network.
    8 // 2. The federator will use the domain from the 'FederatedRequest' to discover
    9 // where to send some data of type 'Request' to.
   10 // 3. On the other side, a publicly exposed 'Inward' service (also co-hosted on the
   11 // federator) will turn the received 'Request' into a 'Response' by making a call to a
   12 // component (e.g. brig) on its private network.
   13 
   14 enum Component {
   15   Brig = 0;
   16   Galley = 1;
   17 }
   18 
   19 message InwardResponse {
   20   oneof response {
   21     InwardError err = 1;
   22     bytes body = 2;
   23   }
   24 }
   25 
   26 message OutwardResponse {
   27   oneof response {
   28     OutwardError outErr = 1;
   29     InwardError inErr = 2;
   30     bytes body = 3;
   31   }
   32 }
   33 
   34 message OutwardError {
   35   enum ErrorType {
   36     RemoteNotFound = 0;
   37     DiscoveryFailed = 1;
   38     ConnectionRefused = 2;
   39     TLSFailure = 3;
   40     VersionMismatch = 4;
   41     FederationDeniedByRemote = 5;
   42     FederationDeniedLocally = 6;
   43     TooMuchConcurrency = 7;
   44     GrpcError = 8;
   45     InvalidRequest = 9;
   46   }
   47 
   48   ErrorType type = 1;
   49   string msg = 2;
   50 }
   51 
   52 message InwardError {
   53   enum ErrorType {
   54     IOther = 0;
   55     IAuthenticationFailed = 1;
   56     IFederationDeniedByRemote = 2;
   57     IInvalidEndpoint = 3;
   58     IForbiddenEndpoint = 4;
   59     IDiscoveryFailed = 5;
   60   }
   61 
   62   ErrorType type = 1;
   63   string msg = 2;
   64 }
   65 
   66 // The envelope message which is sent from brig to the Outward service of a local federator
   67 message FederatedRequest {
   68   string domain = 1;
   69   Request request = 2;
   70 }
   71 
   72 // The request message is not a high-level protocol of federation. Instead, it
   73 // allows encoding more-or-less arbitrary HTTP requests. The idea is to separate
   74 // the concern of discovery and routing (federator's domain) from the concern of
   75 // actual API routes available in a federated context (those are currently
   76 // specified within each component. This may change in the future, however).
   77 // FUTUREWORK(Akshay): detail the design thoughts behind this type a bit more
   78 message Request {
   79   Component component = 1;
   80   bytes path = 2; //Maybe this can be made into a 'function name'
   81   bytes body = 3;
   82   string originDomain = 4;
   83 }
   84 
   85 // The federator actually listens on two ports and exposes two services:
   86 //
   87 // 'Outward' is only accessible from within the private network and serves
   88 // as a forwarding service to other backends.
   89 //
   90 // Example: 'brig' will use Outward.call on an internal server on
   91 //          127.0.0.1:8097 to (indirectly) talk to the federated world.
   92 service Outward {
   93   rpc call (FederatedRequest) returns (OutwardResponse);
   94 }
   95 
   96 // 'Inward' is exposed to the public internet (via nginx) and serves as a
   97 // forwarding service within its own private network
   98 //
   99 // Example: 'federator' will use Inward.call on federator.another-domain to
  100 //           talk to a component inside the group of servers of another-domain
  101 //           which is not directly accessible.
  102 service Inward {
  103   rpc call (Request) returns (InwardResponse);
  104 }