Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sir-go/utm5-urfa-api
json-rpc api-proxy for urfa-protocol
https://github.com/sir-go/utm5-urfa-api
api go json-rpc network protocol urfa
Last synced: 11 days ago
JSON representation
json-rpc api-proxy for urfa-protocol
- Host: GitHub
- URL: https://github.com/sir-go/utm5-urfa-api
- Owner: sir-go
- Created: 2022-10-04T12:10:13.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-12T16:05:57.000Z (over 1 year ago)
- Last Synced: 2024-11-06T22:08:34.276Z (2 months ago)
- Topics: api, go, json-rpc, network, protocol, urfa
- Language: Go
- Homepage:
- Size: 272 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JSON-RPC API proxy for URFA-protocol (UTM5 billing)
[![Go](https://github.com/sir-go/utm5-urfa-api/actions/workflows/go.yml/badge.svg)](https://github.com/sir-go/utm5-urfa-api/actions/workflows/go.yml)## Task
The Netup UTM5 billing system has a rich API based on a proprietary binary protocol.We need some Web API for interacting with the billing kernel.
## The solution
We researched the binary protocol and made the go library implements the most needed functions.Also, we developed the JSON-RPC API-proxy service with the basic-auth.
All of the RPC functions are described in the `api.xml` file on the URFA server.
Not all of the functions are implemented yet, but `internal/urfa/fn/_tmpl.go` contains the skeleton for extending
the functionality if needed.## Test
```bash
go test -v ./...
gosec -exclude G402,G401,G501 ./...
```## Docker
```bash
ocker build -t urfa-api .
docker run -d --name urfa-api -p 8081:8483 urfa-api -h localhost:8483
```## Build
```bash
go mod download
go build -o urfa-api ./cmd/api
```## Flags
`-c ` - path to `*.yml` config file
`-h ` - address and port on which the service will run## Config
Example config:
```yaml
# array of billing servers connections
billings:# billing server with the 'test.' prefix
test:
# URFA server host:port
addr: 192.168.122.168:11758
# path to the client certificate
cert: urfa.crt# billing server with the 'tv.' prefix
tv:
# URFA server host:port
addr: 192.168.28.135:11758
# path to the client certificate
cert: urfa.crt
````urfa.crt` contains the client certificate (PEM) that can be grabbed from the desktop client `utm_admin`
and needed for SSL wrapping on the transport layer.## Usage
```bash
./urfa-api -c conf.yml
```Request example:
```json
{
"jsonrpc": "2.0",
"id": 3,
"method": "test.rpcf_get_userinfo",
"params": {
"user_id": 920
}
}
```
The method must have the prefix equal to the billing name in the config.