Configuration

fasp.io Gateway Configuration File

The fasp.io Gateway configuration file, gateway.toml, is located in the system /etc directory:
/etc/fasp.io/gateway.toml

The gateway.toml included in the installation is provided as an example. Modify this file to specify your ports, hostnames, and so on.

Configuration Examples

Gateway Client/Server Example

In this configuration, two fasp.io Gateways are used to bridge one (or several) TCP connections from TCP clients to a TCP server over FASP:



Given a Server listening on port 12345, configure your client to point to the fasp.io Gateway 1 (GW1 IP) and port 12345:

fasp.io GW1 Configuration
[[bridge]]
   [bridge.local]
       protocol = "tcp"
           host = "0.0.0.0"
           port = 12345
  
   [bridge.forward]
       protocol = "fasp"
           host = "GW2"
           port = 12345

fasp.io GW2 Configuration

[[bridge]]
   [bridge.local]
       protocol = "fasp"
           host = "0.0.0.0"
           port = 12345

   [bridge.forward]
       protocol = "tcp"
           host = "Server"
           port = 12345

Gateway Server/Server Example

For some use cases, such as DB replication or messaging services (like MQ or Event Streams), communication must be established by both sides. In this mode, each server initiates a connection to the other:

fasp.io GW1 Configuration
[[bridge]]
   name = "Outbound"
   [bridge.local]
       protocol = "tcp"
           host = "0.0.0.0"
           port = 12345

   [bridge.forward]
       protocol = "fasp"
           host = "GW2"
           port = 12345

[[bridge]]
   name = "Inbound"
   [bridge.local]
       protocol = "fasp"
           host = "0.0.0.0"
           port = 54321

   [bridge.forward]
       protocol = "tcp"
           host = "Server1"
           port = 54321
fasp.io GW2 Configuration
[[bridge]]
   name = "Outbound"
   [bridge.local]
       protocol = "tcp"
           host = "0.0.0.0"
           port = 54321

   [bridge.forward]
       protocol = "fasp"
           host = "GW1"
           port = 54321

[[bridge]]
   name = "Inbound"
   [bridge.local]
       protocol = "fasp"
           host = "0.0.0.0"
           port = 12345

   [bridge.forward]
       protocol = "tcp"
           host = "Server2"
           port = 12345

Logging Configuration File

Logging configuration is defined in logging.toml. This file is located in the same config directory as gateway.toml (location described above). Warning, error, and info logs are sent to the console by default. In the default logging.toml file, four loggers are made available:

  • gateway – High-level logger for the gateway.
  • s2s – Stream-to-stream session class logger.
  • fasp.io-cpp – Logger for the Asio/C++ FASP SDK.
  • fasp.io-c – Logger for the FASP protocol.

For more information on how to configure logging, see the full reference at:

https://github.com/guangie88/spdlog_setup

Notes:
  • The level setting is optional for both sinks and loggers.
  • The level for error logging is err, not error.
  • The _st suffix means single-threaded.
  • The _mt suffix means multi-threaded.
  • syslog_sink is thread-safe by default. No _mt suffix is required.
The spdlog default logging format is:
[2014-10-31 23:46:59.678] [loggername] [info] Some message

For information on how to customize spdlog formatting, see:

https://github.com/gabime/spdlog/wiki/3.-Custom-formatting