mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-29 14:25:13 +08:00
🍓 Sync 2026-09-15 02:13:06
This commit is contained in:
1 parent
0e5393594c
commit
1dd96ac2bb
146 files changed
+26541
-508
No files matched your search
@@ -0,0 +1,17 @@
|
||||
|
||||
config cloudflared 'config'
|
||||
option enabled '0'
|
||||
option token ''
|
||||
# option config '/etc/cloudflared/config.yml'
|
||||
# option origincert '/etc/cloudflared/cert.pem'
|
||||
option edge_bind_address ''
|
||||
option edge_ip_version ''
|
||||
option grace_period ''
|
||||
option protocol 'auto'
|
||||
option region ''
|
||||
option retries ''
|
||||
option tag ''
|
||||
option metrics ''
|
||||
option loglevel 'info'
|
||||
option logfile '/var/log/cloudflared.log'
|
||||
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2021 Tianling Shen <cnsztl@immortalwrt.org>
|
||||
|
||||
USE_PROCD=1
|
||||
START=99
|
||||
|
||||
CONF="cloudflared"
|
||||
PROG="/usr/bin/cloudflared"
|
||||
|
||||
append_param_arg() {
|
||||
local value
|
||||
|
||||
config_get value "config" "$1" $2
|
||||
[ -n "$value" ] && procd_append_param command "--${1//_/-}" "$value"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load "$CONF"
|
||||
|
||||
local enabled
|
||||
local token
|
||||
|
||||
config_get_bool enabled "config" "enabled"
|
||||
[ "$enabled" -eq "1" ] || return 1
|
||||
|
||||
procd_open_instance "$CONF"
|
||||
procd_set_param command "$PROG" "tunnel"
|
||||
procd_append_param command "--no-autoupdate"
|
||||
|
||||
append_param_arg "edge_bind_address"
|
||||
append_param_arg "edge_ip_version"
|
||||
append_param_arg "grace_period"
|
||||
append_param_arg "protocol"
|
||||
append_param_arg "region"
|
||||
append_param_arg "retries"
|
||||
append_param_arg "tag"
|
||||
append_param_arg "metrics"
|
||||
append_param_arg "loglevel"
|
||||
append_param_arg "logfile"
|
||||
|
||||
config_get token "config" "token"
|
||||
if [ -z "$token" ]; then
|
||||
# Locally-managed tunnels
|
||||
append_param_arg "config" "/etc/cloudflared/config.yml"
|
||||
append_param_arg "origincert" "/etc/cloudflared/cert.pem"
|
||||
fi
|
||||
|
||||
procd_append_param command "run"
|
||||
|
||||
if [ -n "$token" ]; then
|
||||
# Remotely-managed tunnel (recommended by Cloudflare)
|
||||
procd_append_param command "--token" "$token"
|
||||
fi
|
||||
|
||||
procd_set_param respawn
|
||||
procd_set_param stderr 1
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "$CONF"
|
||||
procd_add_interface_trigger "interface.*.up" "wan" /etc/init.d/cloudflared restart
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
# https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/do-more-with-tunnels/local-management/configuration-file/
|
||||
|
||||
# NOTICE
|
||||
# Cloudflare recommends setting up a remotely-managed tunnel.
|
||||
# Remotely-managed configurations are stored on Cloudflare,
|
||||
# which allows you to manage the tunnel from any machine
|
||||
# using the dashboard, API, or Terraform.
|
||||
|
||||
#tunnel: <Tunnel-UUID>
|
||||
#credentials-file: /etc/cloudflared/<Tunnel-UUID>.json
|
||||
#
|
||||
#ingress:
|
||||
# - hostname: luci.example.com
|
||||
# service: http://localhost:80
|
||||
# - hostname: ssh.example.com
|
||||
# service: ssh://localhost:22
|
||||
# - service: http_status:404
|
||||
Reference in new issue
Block a user