initial
This commit is contained in:
commit
6330e844bc
0
.dockerignore
Normal file
0
.dockerignore
Normal file
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.env
|
||||||
|
deploy.sh
|
||||||
|
palanticshelper
|
||||||
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM golang:1.24
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV PATH="/go/bin:${PATH}"
|
||||||
|
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Explicitly copy and set permissions for servego4lage.sh
|
||||||
|
COPY servego4lage.sh /app/servego4lage.sh
|
||||||
|
RUN chmod +x /app/servego4lage.sh
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/servego4lage.sh"]
|
||||||
62
README.md
Normal file
62
README.md
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
# Palantics Tracker Helper
|
||||||
|
|
||||||
|
A tool that counters anti-tracking measures by removing third-party requests. Your server will do the requests instead.
|
||||||
|
|
||||||
|
This is the recommended way to setup palantics. But only using the frontend script with the tracker server directly does work as well :)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### 1. Copy or clone this repo to your server
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp example.env .env
|
||||||
|
```
|
||||||
|
|
||||||
|
Edit your `.env` file and make sure you use the correct tracking server.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Update your Reverse Proxy config
|
||||||
|
|
||||||
|
Configure your reverse proxy to catch requests and forward them to Palantics Helper.
|
||||||
|
|
||||||
|
Remember to set the PORT correctly to match your .env PORT.
|
||||||
|
|
||||||
|
#### NGINX:
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
location /spur {
|
||||||
|
proxy_pass http://127.0.0.1:8101;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Traefik:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Traefik configuration
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.palantics.rule=Host(`yourdomain.com`) && PathPrefix(`/spur`)"
|
||||||
|
- "traefik.http.routers.palantics.entrypoints=web,websecure"
|
||||||
|
- "traefik.http.routers.palantics.tls=true"
|
||||||
|
- "traefik.http.services.palantics.loadbalancer.server.port=8101"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Update Global Server Config
|
||||||
|
|
||||||
|
In the global server config in your frontend, replace the tracker endpoint with your own domain:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<!-- Global server config -->
|
||||||
|
<script>
|
||||||
|
const server = "https://karlbreuer.com";
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
INSTEAD of your tracker endpoint `https://tracking1.karlbreuer.com`
|
||||||
10
docker-compose.yml
Normal file
10
docker-compose.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
env_file: ".env"
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "${PORT}:${PORT}"
|
||||||
|
volumes:
|
||||||
|
- ./.env:/app/.env
|
||||||
|
container_name: "${APP_NAME}_app"
|
||||||
|
restart: unless-stopped
|
||||||
5
example.env
Normal file
5
example.env
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
PORT=8101 #The Port of this app. just use a free port. Make this consistent with your Nginx or Traeffik config.
|
||||||
|
DOMAIN=karlbreuer.com #This should be your domain.
|
||||||
|
DEBUG=TRUE #Debug mode. FALSE in Prod
|
||||||
|
TRACKINGSERVERURL=tracking1.karlbreuer.com # The palantics tracking server. Provided by palantics.
|
||||||
|
APP_NAME=palanticshelper
|
||||||
9
go.mod
Normal file
9
go.mod
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
module gitea.karlbreuer.com/karl/palanticshelper
|
||||||
|
|
||||||
|
go 1.24.0
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/DeanPDX/dotconfig v1.0.0
|
||||||
|
github.com/go-chi/chi v1.5.5
|
||||||
|
github.com/go-chi/cors v1.2.1
|
||||||
|
)
|
||||||
6
go.sum
Normal file
6
go.sum
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
github.com/DeanPDX/dotconfig v1.0.0 h1:hVBXe96OcU4YHqropy4zpKvcU6qc7PmTpsDBrUj5Lu0=
|
||||||
|
github.com/DeanPDX/dotconfig v1.0.0/go.mod h1:18zbUTCrXlYeQqJmrtjBVtNFTUPEfqTzdrf8dh1kHNc=
|
||||||
|
github.com/go-chi/chi v1.5.5 h1:vOB/HbEMt9QqBqErz07QehcOKHaWFtuj87tTDVz2qXE=
|
||||||
|
github.com/go-chi/chi v1.5.5/go.mod h1:C9JqLr3tIYjDOZpzn+BCuxY8z8vmca43EeMgyZt7irw=
|
||||||
|
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
|
||||||
|
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
|
||||||
9
main.go
Normal file
9
main.go
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gitea.karlbreuer.com/karl/palanticshelper/pkg/palanticshelper"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
palanticshelper.StartServer()
|
||||||
|
}
|
||||||
25
pkg/settings/settings.go
Normal file
25
pkg/settings/settings.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package settings
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/DeanPDX/dotconfig"
|
||||||
|
)
|
||||||
|
|
||||||
|
var Settings PhelperSettings
|
||||||
|
|
||||||
|
type PhelperSettings struct {
|
||||||
|
Domain string `env:"DOMAIN"`
|
||||||
|
TrackingServerURL string `env:"TRACKINGSERVERURL"`
|
||||||
|
Debug bool `env:"DEBUG"`
|
||||||
|
Port string `env:"PORT"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
|
||||||
|
var err error
|
||||||
|
Settings, err = dotconfig.FromFileName[PhelperSettings](".env")
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("Error: %v.", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
5
servego4lage.sh
Normal file
5
servego4lage.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
go build -o palantics
|
||||||
|
./palantics
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user