diff options
Diffstat (limited to 'roles/hysteria/templates')
| -rw-r--r-- | roles/hysteria/templates/config.json.j2 | 52 | ||||
| -rw-r--r-- | roles/hysteria/templates/hysteria.rc.j2 | 22 |
2 files changed, 74 insertions, 0 deletions
diff --git a/roles/hysteria/templates/config.json.j2 b/roles/hysteria/templates/config.json.j2 new file mode 100644 index 00000000..40dde2e4 --- /dev/null +++ b/roles/hysteria/templates/config.json.j2 @@ -0,0 +1,52 @@ +{ + "listen": "0.0.0.0:{{ hysteria_port | default('4435') }}", + "tls": { + "cert": "/certs/server-cert.pem", + "key": "/certs/server-key.pem" + }, + "disableUDP": false, + "bandwidth": { + "up": "1 gbps", + "down": "1 gbps" + }, + "auth": { + "type": "userpass", + "userpass": {} + }, + "obfs": { + "type": "salamander", + "salamander": { + "password": "{{ salamander_password }}" + } + }, + "resolver": { + "type": "udp", + "udp": { +{% if not lookup('vars', 'disable_dns', default=false) %} + "addr": "{{ ansible_all_ipv4_addresses[0] }}" +{% else %} + "addr": "9.9.9.9" +{% endif %} + } + }, + "outbounds": [{ + "name": "direct_out", + "type": "direct", + "direct": { + "mode": "auto" + }}], + "trafficStats": { + "listen": "127.0.0.1:9999", + "secret": "secret" + }, + "masquerade": { + "type": "string", + "string": { + "content": "Hello World", + "headers": { + "content-type": "text/plain" + }, + "statusCode": 200 + } + } +} diff --git a/roles/hysteria/templates/hysteria.rc.j2 b/roles/hysteria/templates/hysteria.rc.j2 new file mode 100644 index 00000000..c0aeed29 --- /dev/null +++ b/roles/hysteria/templates/hysteria.rc.j2 @@ -0,0 +1,22 @@ +#!/bin/ksh +# +# $OpenBSD: hysteria + +chroot_dir=/var/reactance/hysteria +chroot_user=_vpn +daemon_class=daemon +daemon=/bin/hysteria +daemon_flags="server -c /etc/config.json" +daemon_user=root +daemon_logger=daemon.info + +. /etc/rc.d/rc.subr + +rc_start() { + rc_exec "chroot -u $chroot_user $chroot_dir $daemon $daemon_flags" +} + +rc_bg=YES +rc_reload=NO + +rc_cmd $1 |
