github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/doc/content/en/docs/dashboard/gate/_index.md (about)

     1  
     2  ---
     3  title: "Gate"
     4  linkTitle: "Gate"
     5  date: 2024-01-04
     6  description: >
     7    
     8  ---
     9  
    10  {{< figure src="/smart-home/img/gate-network.svg" >}}
    11  
    12  Gate Server in the Smart Home system is a key component that provides secure and convenient remote access to the smart home, even in the absence of a static IP address. This server enables users to control and monitor their home from anywhere in the world via the internet, ensuring data security and comfortable interaction.
    13  
    14  #### Advantages of the Gate Server in the Smart Home System
    15  
    16  1. **Security:**
    17      - **Data Encryption:** All data transmitted between devices and the Gate Server is encrypted to prevent unauthorized access.
    18      - **Authentication:** Built-in authentication mechanisms ensure that only authorized users have access to the system.
    19  
    20  2. **Convenience of Remote Access:**
    21      - **No White IP:** Users can connect to the system even without a static IP address, making remote access more convenient and accessible.
    22  
    23  3. **Configuration Flexibility:**
    24      - **Connect to Test Gateway:** Smart Home provides a built-in Gate client that can connect to a test gateway at https://gate.e154.ru:8443 for testing and configuring remote access.
    25  
    26  4. **Scalability:**
    27      - **Support for Multiple Devices:** The Gate Server is designed to handle simultaneous requests from multiple devices, ensuring system scalability.
    28  
    29  #### Working with the Gate Client in the Smart Home System
    30  
    31  1. **Setting Up the Gate Client:**
    32      - Enable the Gate Server mode in the Smart Home system, specifying the address of the test gateway or setting up your Gate Server.
    33      - Configure security parameters such as encryption and authentication.
    34  
    35  2. **Connecting to the Gate Server:**
    36      - The Gate client automatically establishes a secure connection with the Gate Server, without requiring a white IP address.
    37      - Users can use mobile applications or the web interface for remote access.
    38  
    39  3. **Secure Remote Management:**
    40      - Users can control devices, monitor the home's status, and receive notifications even when away from home.
    41  
    42  ### Server Configuration
    43  
    44  ```bash
    45  cat config.gate.json
    46  
    47  {
    48    "api_http_port": 8080,
    49    "api_https_port": 8443,
    50    "api_debug": false,
    51    "api_gzip": true,
    52    "pprof": false,
    53    "domain": "localhost",
    54    "https": false,
    55    "proxy_timeout": 5,
    56    "proxy_idle_timeout": 10,
    57    "proxy_secret_key": ""
    58  }
    59  ```
    60  
    61  Properties for the `config.gate.json` configuration file:
    62  
    63  1. **`api_http_port` (int):**
    64     - **Description:** Port for the HTTP API server.
    65     - **Example Value:** `8080`.
    66  
    67  2. **`api_https_port` (int):**
    68     - **Description:** Port for the HTTPS API server.
    69     - **Example Value:** `8443`.
    70  
    71  3. **`api_debug` (bool):**
    72     - **Description:** Enable debug mode for the API server.
    73     - **Example Value:** `true` (enabled).
    74  
    75  4. **`api_gzip` (bool):**
    76     - **Description:** Enable Gzip compression for API requests.
    77     - **Example Value:** `true` (enabled).
    78  
    79  5. **`domain` (string):**
    80     - **Description:** Domain name for the Gate server.
    81     - **Example Value:** `example.com`.
    82  
    83  6. **`pprof` (bool):**
    84     - **Description:** Enable server profiling mode.
    85     - **Example Value:** `true` (enabled).
    86  
    87  7. **`https` (bool):**
    88     - **Description:** Enable the use of Let's Encrypt for automatic SSL certificate acquisition for the specified domain.
    89     - **Example Value:** `true` (enabled).
    90  
    91  8. **`proxy_timeout` (int):**
    92     - **Description:** Timeout for proxy connections in seconds.
    93     - **Example Value:** `5`.
    94  
    95  9. **`proxy_idle_timeout` (int):**
    96     - **Description:** Timeout for proxy connections in seconds when there is no activity.
    97     - **Example Value:** `10`.
    98  
    99  10. **`proxy_secret_key` (string):**
   100     - **Description:** Secret key to ensure the security of proxy connections.
   101     - **Example Value:** `mySecretKey`.
   102  
   103  These parameters provide flexible control over the settings of the Gate server, including security, operating modes, and the use of SSL certificates via Let's Encrypt.
   104  
   105  ### Server Launch
   106  
   107  The Gate server is integrated into the smart-home system as a separate mode by specifying the `gate` argument during startup.
   108  
   109  ```bash
   110  ./smart-home help gate
   111  Organization of remote access without white IP
   112  
   113  Usage:
   114    server gate [flags]
   115  
   116  Flags:
   117    -h, --help   help for gate
   118  
   119  
   120  ./smart-home gate
   121  
   122    ___      _
   123   / __|__ _| |_ ___
   124  | (_ / _' |  _/ -_)
   125   \___\__,_|\__\___|
   126  
   127  
   128  INFO	gate            	server/gate_server.go:93 >	Started ...
   129  INFO	gate            	server/server.go:117 >	server started at :8080
   130  ```