diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index c6a57ab..8bc25f6 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,4 +1,3 @@ # These are supported funding model platforms - github: [christianchiarulli, jchiarulli] patreon: chrisatmachine diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d4169b7..b70fb47 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -5,24 +5,23 @@ name: Go on: push: - branches: [ "master" ] + branches: ["master"] pull_request: - branches: [ "master" ] + branches: ["master"] jobs: - build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: '1.22.4' + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.22.4" - - name: Build - run: go build -v ./... + - name: Build + run: go build -v ./... - - name: Test - run: go test -v ./... + - name: Test + run: go test -v ./... diff --git a/.gitignore b/.gitignore index 171e37b..6997798 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -relaywiz +rwz # Ignore .DS_Store files .DS_Store diff --git a/pkg/relays/khatru29/nginx_https.go b/pkg/relays/khatru29/nginx_https.go index b148fb9..7f7318c 100644 --- a/pkg/relays/khatru29/nginx_https.go +++ b/pkg/relays/khatru29/nginx_https.go @@ -34,10 +34,10 @@ server { root /var/www/%s; location / { - # First attempt to serve request as file, then - # as directory, then fall back to displaying 404. - try_files $uri $uri/ =404; - proxy_pass http://websocket_khatru29; + # First attempt to serve request as file, then + # as directory, then fall back to displaying 404. + try_files $uri $uri/ =404; + proxy_pass http://websocket_khatru29; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; @@ -68,7 +68,7 @@ server { # Compilation of the top cipher suites 2024: # https://ssl-config.mozilla.org/#server=nginx ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305"; - + # Perfect Forward Secrecy (PFS) is frequently compromised without this ssl_prefer_server_ciphers on; diff --git a/pkg/relays/khatru_pyramid/nginx_https.go b/pkg/relays/khatru_pyramid/nginx_https.go index 4109877..4432769 100644 --- a/pkg/relays/khatru_pyramid/nginx_https.go +++ b/pkg/relays/khatru_pyramid/nginx_https.go @@ -34,10 +34,10 @@ server { root /var/www/%s; location / { - # First attempt to serve request as file, then - # as directory, then fall back to displaying 404. - try_files $uri $uri/ =404; - proxy_pass http://websocket_khatru_pyramid; + # First attempt to serve request as file, then + # as directory, then fall back to displaying 404. + try_files $uri $uri/ =404; + proxy_pass http://websocket_khatru_pyramid; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; @@ -68,7 +68,7 @@ server { # Compilation of the top cipher suites 2024: # https://ssl-config.mozilla.org/#server=nginx ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305"; - + # Perfect Forward Secrecy (PFS) is frequently compromised without this ssl_prefer_server_ciphers on; diff --git a/pkg/relays/strfry/nginx_http.go b/pkg/relays/strfry/nginx_http.go index e8bc852..d917b98 100644 --- a/pkg/relays/strfry/nginx_http.go +++ b/pkg/relays/strfry/nginx_http.go @@ -24,9 +24,9 @@ func ConfigureNginxHttp(domainName string) { server { listen 80; listen [::]:80; - server_name %s; + server_name %s; - location /.well-known/acme-challenge/ { + location /.well-known/acme-challenge/ { root /var/www/%s; allow all; } diff --git a/pkg/relays/strfry/nginx_https.go b/pkg/relays/strfry/nginx_https.go index 82d2857..2143736 100644 --- a/pkg/relays/strfry/nginx_https.go +++ b/pkg/relays/strfry/nginx_https.go @@ -25,15 +25,15 @@ func ConfigureNginxHttps(domainName string) { root /var/www/%s; location / { - # First attempt to serve request as file, then - # as directory, then fall back to displaying 404. - try_files $uri $uri/ =404; - proxy_pass http://127.0.0.1:7777; - proxy_http_version 1.1; + # First attempt to serve request as file, then + # as directory, then fall back to displaying 404. + try_files $uri $uri/ =404; + proxy_pass http://127.0.0.1:7777; + proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; + proxy_set_header Connection "upgrade"; proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } #### SSL Configuration #### @@ -59,7 +59,7 @@ func ConfigureNginxHttps(domainName string) { # Compilation of the top cipher suites 2024: # https://ssl-config.mozilla.org/#server=nginx ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305"; - + # Perfect Forward Secrecy (PFS) is frequently compromised without this ssl_prefer_server_ciphers on; diff --git a/pkg/relays/wot_relay/nginx_http.go b/pkg/relays/wot_relay/nginx_http.go index 498643b..b8014e7 100644 --- a/pkg/relays/wot_relay/nginx_http.go +++ b/pkg/relays/wot_relay/nginx_http.go @@ -22,7 +22,7 @@ func ConfigureNginxHttp(domainName string) { configContent = fmt.Sprintf(`map $http_upgrade $connection_upgrade { default upgrade; - '' close; + '' close; } upstream websocket_wot_relay { @@ -32,23 +32,23 @@ upstream websocket_wot_relay { # %s server { listen 80; - listen [::]:80; - server_name %s; + listen [::]:80; + server_name %s; - location /.well-known/acme-challenge/ { - root /var/www/%s; - allow all; - } + location /.well-known/acme-challenge/ { + root /var/www/%s; + allow all; + } location / { - proxy_pass http://websocket_wot_relay; + proxy_pass http://websocket_wot_relay; proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; + proxy_set_header Connection $connection_upgrade; } } `, domainName, domainName, domainName) diff --git a/pkg/relays/wot_relay/nginx_https.go b/pkg/relays/wot_relay/nginx_https.go index bd623d3..046d4b2 100644 --- a/pkg/relays/wot_relay/nginx_https.go +++ b/pkg/relays/wot_relay/nginx_https.go @@ -34,17 +34,17 @@ server { root /var/www/%s; location / { - # First attempt to serve request as file, then - # as directory, then fall back to displaying 404. - try_files $uri $uri/ =404; - proxy_pass http://websocket_wot_relay; + # First attempt to serve request as file, then + # as directory, then fall back to displaying 404. + try_files $uri $uri/ =404; + proxy_pass http://websocket_wot_relay; proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; + proxy_set_header Connection $connection_upgrade; } #### SSL Configuration #### @@ -70,7 +70,7 @@ server { # Compilation of the top cipher suites 2024: # https://ssl-config.mozilla.org/#server=nginx ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305"; - + # Perfect Forward Secrecy (PFS) is frequently compromised without this ssl_prefer_server_ciphers on; @@ -83,7 +83,7 @@ server { # By default, the buffer size is 16k, which corresponds to minimal overhead when sending big responses. # To minimize Time To First Byte it may be beneficial to use smaller values - ssl_buffer_size 8k; + ssl_buffer_size 8k; # OCSP stapling ssl_stapling on; diff --git a/pkg/relays/wot_relay/service.go b/pkg/relays/wot_relay/service.go index 1d1efb1..5b0d101 100644 --- a/pkg/relays/wot_relay/service.go +++ b/pkg/relays/wot_relay/service.go @@ -18,8 +18,8 @@ func SetupRelayService(domain, pubKey string) {