Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoAnime Servidor - Lógica VPS

Backend server para o sistema GoAnime, rodando nas VPS.

Componentes

  • 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

Estrutura

├── 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

Endpoints API

Cache System

  • GET /v1/cache/search?q=<query> - Busca vídeos em cache
  • GET /v1/cache/get?id=<id> - Obtém vídeo do cache
  • GET /v1/cache/popular - Lista vídeos populares
  • GET /v1/cache/stream?magnet=<magnet> - Stream com cache automático

Streaming

  • GET /v1/stream - Stream de vídeo
  • GET /v1/subtitle - Legendas

Deploy na VPS

Requisitos

  • PostgreSQL 14+
  • Redis 6+
  • Go 1.21+

Systemd Services

# /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.target

Tabelas SQL

CREATE 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);

Build

# Linux (para VPS)
GOOS=linux GOARCH=amd64 go build -o player-linux ./cmd/

# Windows (local)
go build -o player.exe ./cmd/

VPS Atual

  • 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)

About

No description, website, or topics provided.

Resources

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages