A Reolink Camera client written in Go. This repository's
purpose (with Reolink's full support) is to deliver a
complete API for the Reolink Cameras,
although they have a basic API document - it does not satisfy the
need for extensive camera communication.
The reolink-go-api project is the go alternative to the reolink-python-api project. It provides the same functionality,
but just in pure Go.
WARNING...This is an untested repository and is in heavy development
Join us on Discord
https://discord.gg/8z3fdAmZJP
Sponsorship
Oleaintueri is sponsoring the development and maintenance of these projects within their organisation.
Installation
If go get is not working for you, please check out this amazing post about
GO111MODULE=onhere.
Using go get
GO111MODULE=on go get github.com/ReolinkCameraAPI/reolinkapigo@latest
A Specific version using @v0.x.x
GO111MODULE=on go get -u github.com/ReolinkCameraAPI/reolinkapigo@v0.0.1
From source
cd $GOPATH
mkdir -p src/github.com/ReolinkCameraAPI
cd src/github.com/ReolinkCameraAPI
git clone https://github.com/ReolinkCameraAPI/reolinkapigo.git
Usage
Check the examples/ directory for example code and implementations.
Implement a "Camera" object by passing it an IP address, Username and Password. By instantiating the object, it will try
retrieve a login token from the Reolink Camera. This token is necessary to interact with the Camera using other
commands.
import "github.com/ReolinkCameraAPI/reolinkapigo"
// This can throw an error due to the API trying to authorise with the camera
// to retrieve the necessary token for future requests.
camera, err := pkg.NewCamera("foo", "bar", "192.168.1.100")
// now call any of the supported api's by passing it it's resthandler
ok, err := camera.FormatHdd(0)(camera.RestHandler)
Writing functions/structs with a lot of parameters
function HasManyParameters(
param1 string,
param2 int,
param3 bool,
...
param100 *Foo,
) {
// Write your code here
}
All variables are camelCase
var someVariable1 string
Package names are all lowercase and if two or more words, camelCase
package foo
package fooBar
Go files are lowercase and if two or more words, snake_case
foo.go
foo_bar.go
How can I become a contributor?
Step 1
Get the Restful API calls by looking through the HTTP Requests made in the camera's web UI. I use Google Chrome developer mode (ctr + shift + i) -> Network.
Step 2
Fork the repository and make your changes.
Step 3
Make a pull request.
Test without a camera
All the tests implement a MockApi. The only test that could be a bit tricky is the RTSP client test.
To test this locally on your machine you could use the rtsp-simple-server
Setting it up is quite easy, however streaming the video feed needs some extra thought, especially if you are new to
ffmpeg.
Steps:
Get rtsp-simple-server (download binary etc.) and Start server.
Find a video file and push content to server
Run the rtsp test
In your terminal:
//receives the stream and passes it along to clients
./rtsp-simple-server
// this will start and encode the stream on the fly
ffmpeg -re -stream_loop -1 \
-i vidfile.mkv \
-c:a aac -b:a 64k -c:v libx264 -preset ultrafast -b:v 500k -f hls -hls_time 1 -hls_list_size 3 -hls_flags delete_segments -hls_allow_cache 0 \
-f rtsp rtsp://localhost:8554/mystream
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
A hospital in Mobile, Alabama, agreed to a settlement in a landmark ransomware death lawsuit, but is now reportedly reconsidering the agreement and refusing to pay.
A new report explores how advancements in LLMs are enhancing cyber threats, including polymorphic malware, personalized spearphishing, and the risk of hijacking customer service bots.
ESLint has approved an RFC that adds support for TypeScript configuration files, which is aimed at improving the developer experience and recognizing changes in the evolving JavaScript ecosystem.