Backend server para o sistema GoAnime, rodando nas VPS.
- Player Server (porta 3002): API de streaming com cache GoFile/TorBox
- Gateway (porta 8080): Proxy reverso e roteamento
- StreamServer (porta 8090): Streaming de vídeo
├── cmd/ # Entry points (player main.go)
├── server/ # HTTP server e handlers
├── playerdatabase/ # PostgreSQL database layer
├── playermodels/ # Structs de dados
├── playerconfig/ # Configuração
├── gofile/ # Cliente GoFile com proxy SOCKS5
├── torbox/ # Cliente TorBox API
├── config/ # Configurações gerais
└── models/ # Modelos de dados
GET /v1/cache/search?q=<query>- Busca vídeos em cacheGET /v1/cache/get?id=<id>- Obtém vídeo do cacheGET /v1/cache/popular- Lista vídeos popularesGET /v1/cache/stream?magnet=<magnet>- Stream com cache automático
GET /v1/stream- Stream de vídeoGET /v1/subtitle- Legendas
- PostgreSQL 14+
- Redis 6+
- Go 1.21+
# /etc/systemd/system/player.service
[Unit]
Description=GoAnime Player Server
After=network.target postgresql.service redis.service
[Service]
Type=simple
WorkingDirectory=/root
ExecStart=/root/player-linux
Restart=always
Environment=DATABASE_URL=postgres://goanime:xxx@localhost:5432/goanime_connect
Environment=REDIS_URL=localhost:6379
Environment=TORBOX_API_KEY=xxx
Environment=PORT=3002
[Install]
WantedBy=multi-user.targetCREATE TABLE video_cache (
id SERIAL PRIMARY KEY,
anime_name TEXT NOT NULL,
episode TEXT NOT NULL,
quality TEXT NOT NULL,
original_url TEXT NOT NULL,
gofile_url TEXT,
file_size BIGINT,
view_count INT DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE(anime_name, episode, quality)
);
CREATE INDEX idx_video_cache_anime ON video_cache(anime_name);
CREATE INDEX idx_video_cache_views ON video_cache(view_count DESC);# Linux (para VPS)
GOOS=linux GOARCH=amd64 go build -o player-linux ./cmd/
# Windows (local)
go build -o player.exe ./cmd/- th-negro (Dual Xeon E5-2696 v3)
- IPv6: 2804:54:c100:2::11
- Tailscale: 100.105.69.69
- Serviços: Player (3002), Gateway (8080), PostgreSQL (5432), Redis (6379)