Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Wayru-Network/network-services

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Network Services

A monorepo containing Go microservices for Wayru network infrastructure. This repository includes services for identity management, network access server operations, accounting, usage scoring, and device package updates.

Overview

This monorepo contains three main applications:

  • IDP (Identity Provider): Authentication and credentials distribution service for Wayru's first-party realm (wayru.io)
  • NAS (Network Access Server): Network accounting, connection tracking, usage statistics, and scoring service
  • WUPI: Worker service for calculating NAS usage scores from accounting data

Features

πŸ” Identity & Authentication: Secure credential distribution and authentication for network access

πŸ“Š Accounting & Tracking: Comprehensive network session accounting and connection tracking

πŸ“ˆ Usage Analytics: Real-time statistics, scoring, and analytics for network usage

πŸ”„ Real-time Processing: MQTT and RabbitMQ integration for real-time data processing

🐳 Containerized: Docker support for all services

☸️ Kubernetes Ready: Kubernetes deployment configurations included

πŸ“¦ Database Integration: PostgreSQL with SQLC for type-safe database queries

πŸ” FreeRADIUS Integration: Full FreeRADIUS compatibility for network authentication

Tech Stack

  • Runtime: Go 1.23+
  • Database: PostgreSQL
  • Query Generation: SQLC
  • Message Queue: RabbitMQ
  • Real-time: MQTT
  • Logging: Zap (Uber)
  • Containerization: Docker
  • Orchestration: Kubernetes

Prerequisites

Before you begin, ensure you have the following installed:

  • Go 1.23+ and Go modules
  • PostgreSQL database
  • SQLC (for query code generation)
  • golang-migrate (for database migrations)
  • Docker (optional, for containerized deployment)
  • Make or Just (for build automation)

Project Structure

network-services/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ idp/          # Identity Provider service
β”‚   β”œβ”€β”€ nas/          # Network Access Server service
β”‚   └── wupi/         # Usage score calculation worker
β”œβ”€β”€ db/               # Database migrations and queries
β”‚   β”œβ”€β”€ idp/          # IDP database migrations
β”‚   β”œβ”€β”€ nas/          # NAS database migrations
β”‚   β”œβ”€β”€ explorers/    # Explorers database migrations
β”‚   └── devices/      # Devices database migrations
β”œβ”€β”€ pkg/              # Shared packages
β”‚   β”œβ”€β”€ api/          # API response utilities
β”‚   β”œβ”€β”€ cache/        # Caching utilities
β”‚   β”œβ”€β”€ logger/       # Logging utilities
β”‚   β”œβ”€β”€ middleware/   # HTTP middlewares
β”‚   β”œβ”€β”€ pgutils/      # PostgreSQL utilities
β”‚   └── router/       # HTTP router
β”œβ”€β”€ docs/             # Documentation
└── go.mod            # Go module definition

Installation

Clone the repository

git clone <repository-url>
cd network-services

Install dependencies

go mod download

Generate database query code

From the root directory, run:

make generate

Or using Just:

just generate idp
just generate nas
just generate wupi

Running the Applications

Each application can be run independently. Navigate to each app directory for specific instructions:

Quick Start

Using Make (if available):

# Build an app
make build app=idp

# Run an app
make run app=idp

# Watch and hot reload
make watch app=idp

Using Just:

# Build an app
just build idp

# Run an app
just run idp

# Watch and hot reload
just watch idp

Database Setup

Migrations

Database migrations are located in the db/ directory, organized by database:

  • db/idp/migrations/ - IDP database migrations
  • db/nas/migrations/ - NAS database migrations
  • db/explorers/migrations/ - Explorers database migrations
  • db/devices/migrations/ - Devices database migrations

Run migrations using golang-migrate:

# Example for IDP database
migrate -path db/idp/migrations -database "postgres://user:password@localhost/dbname?sslmode=disable" up

Query Generation

This project uses SQLC to generate type-safe Go code from SQL queries. After writing queries in the queries/ directories, run:

make generate

Development

Code Generation

The project uses SQLC for database query code generation. Each app has its own sqlc.yaml configuration file.

Project Structure Guidelines

  • Each app follows a similar structure:
    • cmd/main.go - Application entry point
    • internal/ - Private application code
      • handlers/ - HTTP request handlers
      • services/ - Business logic
      • repository/ - Data access layer
      • infra/ - Infrastructure setup (DB, env)
    • queries/ - SQL queries for SQLC
    • deploy/ - Deployment configurations

Shared Packages

The pkg/ directory contains shared packages used across applications:

  • api/ - API response utilities
  • cache/ - Caching layer
  • logger/ - Structured logging
  • middleware/ - HTTP middlewares (auth, logging, etc.)
  • pgutils/ - PostgreSQL connection and query utilities
  • router/ - HTTP router implementation

Docker Deployment

Each application includes a Dockerfile. Build and run:

# Build IDP
docker build -t idp-api -f apps/idp/Dockerfile .

# Build NAS
docker build -t nas-api -f apps/nas/Dockerfile .

# Build WUPI
docker build -t wupi -f apps/wupi/Dockerfile .

Kubernetes Deployment

Kubernetes configuration files are available in each app's deploy/ directory. Update the configuration files with your specific values before deploying.

Configuration

Each service requires specific environment variables. See individual app READMEs for detailed configuration:

Documentation

Additional documentation is available in the docs/ directory:

  • database.md - Database setup and structure
  • deploy.md - Deployment instructions
  • deploy_idp.md - IDP-specific deployment
  • migrations.md - Migration guidelines
  • freeradius_specs.md - FreeRADIUS integration specifications

Contributing

This project is now open source. Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

This project is licensed under the MIT License.

Support

Important: This project is now open source and maintained by the community. WAYRU no longer exists and will not provide support for this repository. For issues, questions, or contributions, please use the GitHub Issues section.

πŸ’™ Farewell Message

With gratitude and love, we say goodbye.

WAYRU is closing its doors, but we are leaving these repositories open and free for the community.

May they continue to inspire builders, dreamers, and innovators.

With love, WAYRU


Note: This project is open source. Wayru, Inc and The Wayru Foundation are no longer operating entities, and will not provide any kind of support. The community is welcome to use, modify, and improve this codebase.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages