mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
**feat(config): add TLS support for HTTPS server configuration**
- Introduced `TLSConfig` to support HTTPS configurations, including enabling TLS, specifying certificate and key files. - Updated HTTP server logic to handle HTTPS mode when TLS is enabled. - Enhanced `config.example.yaml` with TLS settings example. - Adjusted internal URL generation to respect protocol based on TLS state.
This commit is contained in:
@@ -23,6 +23,9 @@ type Config struct {
|
||||
// Port is the network port on which the API server will listen.
|
||||
Port int `yaml:"port" json:"-"`
|
||||
|
||||
// TLS config controls HTTPS server settings.
|
||||
TLS TLSConfig `yaml:"tls" json:"tls"`
|
||||
|
||||
// AmpUpstreamURL defines the upstream Amp control plane used for non-provider calls.
|
||||
AmpUpstreamURL string `yaml:"amp-upstream-url" json:"amp-upstream-url"`
|
||||
|
||||
@@ -82,6 +85,16 @@ type Config struct {
|
||||
Payload PayloadConfig `yaml:"payload" json:"payload"`
|
||||
}
|
||||
|
||||
// TLSConfig holds HTTPS server settings.
|
||||
type TLSConfig struct {
|
||||
// Enable toggles HTTPS server mode.
|
||||
Enable bool `yaml:"enable" json:"enable"`
|
||||
// Cert is the path to the TLS certificate file.
|
||||
Cert string `yaml:"cert" json:"cert"`
|
||||
// Key is the path to the TLS private key file.
|
||||
Key string `yaml:"key" json:"key"`
|
||||
}
|
||||
|
||||
// RemoteManagement holds management API configuration under 'remote-management'.
|
||||
type RemoteManagement struct {
|
||||
// AllowRemote toggles remote (non-localhost) access to management API.
|
||||
|
||||
Reference in New Issue
Block a user