๐ Go-SMS-Gateway
June 5, 2025 ยท View on GitHub
๐ฑ 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.