A high-performance Lineage II Login Server written in Go
2.0K
A high-performance Lineage II Login Server written in Go.
l2go-auth is designed to be a lightweight, secure. It focuses on high throughput, minimal memory footprint, and
production-grade reliability using an event-driven networking model.
BanManager that tracks failed attempts and automatically jails IPs.Clone the repository:
git clone https://github.com/mmo-dev-team/l2go-auth.git
cd l2go-auth
Install dependencies:
go mod download
Generate database code:
# Make sure you have sqlc installed (go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest)
go generate ./...
Setup the database:
Execute the schema found in `schemas/l2auth.sql` on your PostgreSQL database.
The application is configured using environment variables. You can find a template in .env.example.
| Variable | Description | Default |
|---|---|---|
GAMESERVER_LISTENER_PORT | Port for Game Server connections | 9014 |
CLIENT_LISTENER_PORT | Port for Client (Game) connections | 2106 |
DB_HOST | PostgreSQL Host | localhost |
DB_PORT | PostgreSQL Port | 5432 |
DB_USER | Database User | l2auth |
DB_PWD | Database Password | l2auth |
DB_NAME | Database Name | l2auth |
DB_SSL_MODE | SSL Mode (disable, require, etc.) | disable |
DB_MAX_CONN | Maximum number of open connections | 20 |
DB_IDLE_CONN | Maximum number of idle connections | 10 |
DB_MAX_LIFETIME | Maximum amount of time a connection may be reused (seconds) | 300 |
DB_MAX_CONN_IDLE_TIME | Maximum amount of time a connection may be idle (seconds) | 60 |
ATTEMPTS_LOGIN_COUNT | Failed login attempts before IP ban | 5 |
AUTO_CREATE_ACCOUNT | Enable/Disable auto account creation | true |
LOGIN_RATE_LIMIT | Max login requests per second | 10 |
.env file or export).go run cmd/main.go
Build the image:
docker build -t l2go-auth .
Run the container:
docker run -d \
--name l2go-auth \
-p 2106:2106 \
-p 9014:9014 \
-p 9090:9090 \
--env-file .env \
l2go-auth
This is the easiest way to start the server along with a PostgreSQL database:
Create a .env file from the example:
cp .env.example .env
Start the services:
docker-compose up -d
This will:
schemas/l2auth.sql.l2go-auth server.The project follows a 3-layer testing strategy:
go test ./pkg/network ./internal/cryptogo test ./internal/listenergo test ./internal/serviceTo run all tests:
go test -v ./...
Metrics are exposed at http://localhost:9090/metrics by default.
Key metrics include:
l2auth_active_connections: Current active TCP sessions.l2auth_connections_total: Total number of established connections.l2auth_login_attempts_total: Success/Failure stats with reason labels.l2auth_db_query_duration_seconds: Histogram of database query latency.l2auth_rsa_decrypt_duration_seconds: Histogram of RSA decryption performance.Contributions are welcome! Adding new features, or fixing bugs, feel free to open a Pull Request.
This project is open-source and available under the Mozilla Public License 2.0 (MPL 2.0).
docker pull mmodevteam/l2go-auth:latest