Categorygithub.com/snowzach/quectool
modulepackage
0.0.0-20240813013046-4f543bd9975a
Repository: https://github.com/snowzach/quectool.git
Documentation: pkg.go.dev

# README

QUECTOOL

This is a GO server to interface with a Quectel Modem

Compiling

This is designed as a go module aware program and thus requires go 1.11 or better You can clone it anywhere, just run make inside the cloned directory to build

Generally it's designed to go on Quectel Modems and you can make an armv7 binary with make armv7 and it will output build/quectool-armv7

Configuration

The configuration is designed to be specified with environment variables in all caps with underscores instead of periods.

Example:
LOGGER_LEVEL=debug

Options:

SettingDescriptionDefault
logger.levelThe default logging level"info"
logger.encodingLogging format (console, json or stackdriver)"console"
logger.colorEnable color in console modetrue
logger.dev_modeDump additional information as part of log messagestrue
logger.disable_callerHide the caller source file and line numberfalse
logger.disable_stacktraceHide a stacktrace on debug logstrue
---------
pidfileIf set, creates a pidfile at the given path""
---------
server.hostThe host address to listen on (blank=all addresses)""
server.portThe port number to listen on8900
server.tlsEnable https/tlsfalse
server.devcertGenerate a development certfalse
server.certfileThe HTTPS/TLS server certificate"server.crt"
server.keyfileThe HTTPS/TLS server key file"server.key"
server.log.enabledLog server requeststrue
server.log.levelLog level for server requests"info
server.log.request_bodyLog the request bodyfalse
server.log.response_bodyLog the response bodyfalse
server.log.ignore_pathsThe endpoint prefixes to not log[]string{"/version"}
server.cors.enabledEnable CORS middlewarefalse
server.cors.allowed_originsCORS Allowed origins[]string{"*"}
server.cors.allowed_methodsCORS Allowed methods[]string{...everything}
server.cors.allowed_headersCORS Allowed headers[]string{"*"}
server.cors.allowed_credentialsCORS Allowed credentialsfalse
server.cors.max_ageCORS Max Age300
modem.portThe port the modem is on/dev/smd11
modem.timeoutThe timeout for modem commands5s

TLS/HTTPS

You can enable https by setting the config option server.tls = true and pointing it to your keyfile and certfile. To create a self-signed cert: openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -keyout server.key -out server.crt It also has the option to automatically generate a development cert every time it runs using the server.devcert option.

API

It's safe to call and endpoints concurrently. The tool will manage concurrent access to the port.

  • GET /api/atcmd?cmd=AT+whatever (make sure to urlencode values)
GET /api/atcmd?cmd=AT%2BCGMM%3B%2BQGMR%3B%2BCGCONTRDP%3D1%3B%2BQUIMSLOT%3F
{
  "status": "OK",
  "response": [
    "RM521F-GL",
    "RM521FGLEAR05A02M4G_01.200.01.200",
    "+CGCONTRDP: 1,4,\"fbb.home\",\"38.7.251.145.22.29.24.56.10.210.41.81.126.70.43.228\", \"254.128.0.0.0.0.0.0.180.109.87.255.254.69.69.69\", \"253.0.151.106.0.0.0.0.0.0.0.0.0.0.0.9\", \"253.0.151.106.0.0.0.0.0.0.0.0.0.0.0.16\"",
    "+QUIMSLOT: 1"
  ]
}

# Packages

No description provided by the author
No description provided by the author
No description provided by the author