๐Ÿš€ Go-SMS-Gateway

June 5, 2025 ยท View on GitHub

License Go Version SMPP

๐Ÿ“ฑ Overview

A high-performance SMS gateway built in Go that bridges telecom networks with modern applications. This service provides robust SMPP protocol support, efficient message queuing, and reliable delivery tracking.

โœจ Features

  • ๐Ÿ”„ Multi-Provider Support: Connect to multiple SMPP providers simultaneously
  • ๐Ÿ“Š Prometheus Metrics: Real-time monitoring of message throughput and delivery rates
  • ๐Ÿšฆ Rate Limiting: Configurable rate limiting per provider to prevent throttling
  • ๐Ÿ” Message Queuing: Redis-backed message queue for reliable message handling
  • ๐Ÿ“‹ Delivery Reports: Track message delivery status with detailed reporting
  • ๐Ÿ”Œ Flexible Session Types: Support for transceiver, receiver, and transmitter sessions
  • ๐Ÿ›ก๏ธ Graceful Shutdown: Clean handling of connection termination and message processing

๐Ÿ› ๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Client    โ”‚     โ”‚  SMS Gateway โ”‚     โ”‚    SMSC     โ”‚
โ”‚  Applicationโ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚    Service   โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  Providers  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚           โ”‚
               โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”
               โ”‚ Redis  โ”‚  โ”‚Databaseโ”‚
               โ”‚ Queue  โ”‚  โ”‚        โ”‚
               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

For more details on the system architecture, see our Architecture Documentation.

๐Ÿš€ Getting Started

Prerequisites

  • Go 1.18+
  • Redis server
  • MySQL/MariaDB database

For detailed installation instructions, see our Installation Guide.

Configuration

Create a config.yaml file with your SMPP provider details:

rate_limit: 100
redis_url: "127.0.0.1:6379"

database_config:
  host: "localhost"
  port: 3306
  user: "root"
  password: "your_password"
  dbname: "sms_gateway"
  max_conn: 50
  max_idle: 25

providers:
  - provider1:
    name: "provider1"
    session_type: "transceiver"
    address: "smpp.provider1.com"
    port: 2775
    system_id: "your_id"
    password: "your_password"
    system_type: ""
    rate_limit: 500
    burst_limit: 500
    max_outstanding: 500
    has_outstanding: true
    max_retries: 3
    queues:
      - "go-provider1-ported"
      - "go-provider1"

For detailed configuration options, see our Configuration Documentation.

Running the Service

# Start the service with default config
./run.sh

# Start with a specific config file
./run.sh custom-config.yaml

๐Ÿ“ฑ API

The SMS Gateway provides a RESTful API for message submission and status tracking. For detailed API documentation, see our API Documentation.

๐Ÿ“Š Monitoring

The service exposes Prometheus metrics for monitoring:

  • Message throughput rates
  • Delivery success/failure rates
  • Queue depths
  • Provider connection status

For detailed information about available metrics and monitoring setup, see our Monitoring Documentation.

๐Ÿ” Future Enhancements

See our Future Enhancements documentation for detailed information about planned improvements.

Testing Improvements

  • ๐Ÿงช Comprehensive unit test coverage
  • ๐Ÿ”„ Integration tests with mock SMPP servers
  • ๐Ÿงฎ Load testing framework for performance benchmarking
  • ๐Ÿ“ Test profiles for complex scenarios including throttling and packet loss

Performance Optimizations

  • โšก Connection pooling for higher throughput
  • ๐Ÿ”„ Bulk database operations for status updates
  • ๐Ÿš€ Optimized message encoding/decoding
  • ๐Ÿ“Š Enhanced metrics collection and visualization

Reliability Features

  • ๐Ÿ”„ Automatic session reconnection with exponential backoff
  • ๐Ÿ’พ Message persistence across restarts
  • ๐Ÿ›ก๏ธ Enhanced error handling and recovery mechanisms
  • ๐Ÿ”„ Background synchronization for delivery reports

Operational Improvements

  • ๐Ÿ”ง Admin dashboard for monitoring and configuration
  • ๐Ÿ“ฑ REST API for message submission and status queries
  • ๐Ÿ” Enhanced security features and authentication
  • ๐Ÿ“‹ Comprehensive logging and audit trails

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.