DGate Server
DGate Server is a high-performance, open-source, and scalable proxy server that sits between a client and the upstream service(s). It is designed to handle a large number of concurrent connections and can be used to load balance, secure, and optimize traffic between clients and services.
Installation
Using Go
go install github.com/dgate-io/dgate/cmd/dgate-server@latest
dgate-server --help
Using Docker
docker pull ghcr.io/dgate-io/dgate:latest
docker run -it --rm ghcr.io/dgate-io/dgate dgate-server --help
Loading...
Setting up DGate Server Config
version: v1
log_level: ${LOG_LEVEL:-info}
tags: ["test"]
storage:
type: file
dir: .dgate/data/
proxy:
port: ${PORT:-80}
host: 0.0.0.0
global_headers:
X-Test-Header: ${TEST_HEADER:-test}
admin:
port: 9080
host: 0.0.0.0
allow_list:
- "192.168.13.37"
- "127.0.0.1/8"
- "::1"
DGate Configuration
Version
version
- Type:
string
- Description: The version of the configuration file.
Log Level
log_level
- Type:
"debug" | "info" | "warn" | "error"
- Description: The log level for the DGate server. Default is `"info"
Log JSON
log_json
- Type:
bool
- Description: If
true
, the logs will be output in JSON format.
Log Color
log_color
- Type:
bool
- Description: If
true
, the logs will be output in color for the log level.
Node ID
node_id
- Type:
string
- Description: The unique identifier for the DGate server.
Storage
storage.type
- Type:
"memory" | "file" | "debug"
- Type:
storage.config
- Type:
map[string]any
- Type:
Proxy Config
proxy.host
- Type:
string
- Type:
proxy.port
- Type:
int
- Type:
proxy.tls
- Type: DGateTLSConfig
proxy.enable_h2c
- Type:
bool
- Type:
proxy.enable_http2
- Type:
bool
- Type:
proxy.enable_console_logger
- Type:
bool
- Type:
proxy.redirect_https
- Type:
[]string
- Type:
proxy.allowed_domains
- Type:
[]string
- Type:
proxy.global_headers
- Type:
map[string]string
- Type:
proxy.client_transport
- Type: DGateHttpTransportConfig
proxy.init_resources
- Type: DGateResources
proxy.disable_x_forwarded_headers
- Type:
bool
- Type:
Admin Config
-
admin.host
- Type:
string
- Type:
-
admin.port
- Type:
int
- Type:
-
admin.allow_list
- Type:
[]string
- Type:
-
admin.x_forwarded_for_depth
- Type:
int
- Type:
-
admin.watch_only
- Type:
bool
- Type:
-
admin.replication
- Type: DGateReplicationConfig
-
admin.tls
- Type: DGateTLSConfig
-
admin.auth_method
- Type:
"basic" | "key" | "jwt"
- Type:
-
admin.basic_auth
- Type: DGateBasicAuthConfig
Test Server Config
test_server.host
- Type:
string
- Type:
test_server.port
- Type:
int
- Type:
test_server.enable_h2c
- Type:
bool
- Type:
test_server.enable_http2
- Type:
bool
- Type:
test_server.enable_env_vars
- Type:
bool
- Type:
test_server.global_headers
- Type:
map[string]string
- Type:
Debug
debug
- Type:
bool
- Type:
Tags
tags
- Type:
[]string
- Type:
Disable Metrics
disable_metrics
- Type:
bool
- Type:
Disable Default Namespace
disable_default_namespace
- Type:
bool
- Type:
Configuration Definitions
DGateNativeModulesConfig
native_modules.name
- Type:
string
- Type:
native_modules.path
- Type:
string
- Type:
DGateReplicationConfig
replication.id
- Type:
string
- Type:
replication.shared_key
- Type:
string
- Type:
replication.bootstrap_cluster
- Type:
bool
- Type:
replication.discovery_domain
- Type:
string
- Type:
replication.cluster_address
- Type:
[]string
- Type:
replication.advert_address
- Type:
string
- Type:
replication.advert_scheme
- Type:
string
- Type:
replication.raft_config
- Type: RaftConfig
RaftConfig
raft_config.heartbeat_timeout
- Type:
time.Duration
- Type:
raft_config.election_timeout
- Type:
time.Duration
- Type:
raft_config.commit_timeout
- Type:
time.Duration
- Type:
raft_config.snapshot_interval
- Type:
time.Duration
- Type:
raft_config.snapshot_threshold
- Type:
int
- Type:
raft_config.max_append_entries
- Type:
int
- Type:
raft_config.trailing_logs
- Type:
int
- Type:
raft_config.leader_lease_timeout
- Type:
time.Duration
- Type:
DGateDashboardConfig
dashboard.enable
- Type:
bool
- Type:
DGateBasicAuthConfig
basic_auth.users
- Type:
[]DGateUserCredentials
- Type:
DGateUserCredentials
basic_auth.users[i].username
- Type:
string
- Type:
basic_auth.users[i].password
- Type:
string
- Type:
DGateTLSConfig
tls.port
- Type:
int
- Type:
tls.cert_file
- Type:
string
- Type:
tls.key_file
- Type:
string
- Type:
DGateHttpTransportConfig
client_transport.dns_server
- Type:
string
- Type:
client_transport.dns_timeout
- Type:
time.Duration
- Type:
client_transport.dns_prefer_go
- Type:
bool
- Type:
client_transport.max_idle_conns
- Type:
int
- Type:
client_transport.max_idle_conns_per_host
- Type:
int
- Type:
client_transport.max_conns_per_host
- Type:
int
- Type:
client_transport.idle_conn_timeout
- Type:
time.Duration
- Type:
client_transport.force_attempt_http2
- Type:
bool
- Type:
client_transport.disable_compression
- Type:
bool
- Type:
client_transport.tls_handshake_timeout
- Type:
time.Duration
- Type:
client_transport.expect_continue_timeout
- Type:
time.Duration
- Type:
client_transport.max_response_header_bytes
- Type:
int64
- Type:
client_transport.write_buffer_size
- Type:
int
- Type:
client_transport.read_buffer_size
- Type:
int
- Type:
client_transport.max_body_bytes
- Type:
int
- Type:
client_transport.disable_keep_alives
- Type:
bool
- Type:
client_transport.keep_alive
- Type:
time.Duration
- Type:
client_transport.response_header_timeout
- Type:
time.Duration
- Type:
client_transport.dial_timeout
- Type:
time.Duration
- Type:
DGateFileConfig
file_config.dir
- Type:
string
- Type:
DGateResources
resources.skip_validation
- Type:
bool
- Type:
resources.namespaces
- Type: []Namespace
resources.services
- Type: []Service
resources.routes
- Type: []Route
resources.modules
- Type: []Module
resources.domains
- Type: []Domain
resources.collections
- Type: []Collection
resources.documents
- Type: []Document
resources.secrets
- Type: []Secret
Namespace
namespace.name
- Type:
string
- Type:
namespace.tags
- Type:
[]string
- Type:
Service
service.name
- Type:
string
- Type:
service.urls
- Type:
[]string
- Type:
service.namespace
- Type:
string
- Type:
service.retries
- Type:
int
- Type:
service.retryTimeout
- Type:
time.Duration
- Type:
service.connectTimeout
- Type:
time.Duration
- Type:
service.requestTimeout
- Type:
time.Duration
- Type:
service.tlsSkipVerify
- Type:
bool
- Type:
service.http2Only
- Type:
bool
- Type:
service.hideDGateHeaders
- Type:
bool
- Type:
service.disableQueryParams
- Type:
bool
- Type:
service.tags
- Type:
[]string
- Type:
Route
route.name
- Type:
string
- Type:
route.paths
- Type:
[]string
- Type:
route.methods
- Type:
[]string
- Type:
route.preserveHost
- Type:
bool
- Type:
route.stripPath
- Type:
bool
- Type:
route.service
- Type:
string
- Type:
route.namespace
- Type:
string
- Type:
route.modules
- Type:
[]string
- Type:
route.tags
- Type:
[]string
- Type:
Module
module.name
- Type:
string
- Type:
module.namespace
- Type:
string
- Type:
module.payload
- Type:
string
- Type:
module.payload_file
- Type:
string
- Type:
module.moduleType
- Type:
"typescript" | "javascript"
- Type:
module.tags
- Type:
[]string
- Type:
Domain
domain.name
- Type:
string
- Type:
domain.namespace
- Type:
string
- Type:
domain.patterns
- Type:
[]string
- Type:
domain.priority
- Type:
int
- Type:
domain.cert
- Type:
string
- Type:
domain.key
- Type:
string
- Type:
domain.cert_file
- Type:
string
- Type:
domain.key_file
- Type:
string
- Type:
domain.tags
- Type:
[]string
- Type:
Collection
collection.name
- Type:
string
- Type:
collection.namespace
- Type:
string
- Type:
collection.schema
- Type:
any
- Type:
collection.visibility
- Type:
"public" | "private"
- Type:
collection.tags
- Type:
[]string
- Type:
Document
document.id
- Type:
string
- Type:
document.createdAt
- Type:
time.Time
- Type:
document.updatedAt
- Type:
time.Time
- Type:
document.namespace
- Type:
string
- Type:
document.collection
- Type:
string
- Type:
document.data
- Type:
any
- Type:
Secret
secret.name
- Type:
string
- Type:
secret.namespace
- Type:
string
- Type:
secret.data
- Type:
string
- Type:
secret.tags
- Type:
[]string
- Type: