Giter Site home page Giter Site logo

mcs-unity / onvif Goto Github PK

View Code? Open in Web Editor NEW
1.0 0.0 0.0 2.56 MB

ONVIF profile S client implementation written in Go

Home Page: https://mcsunity.com

License: GNU General Public License v3.0

Go 97.81% Makefile 2.19%
onvif ws-discovery rtsp-client ptz

onvif's Introduction

mcs logo

Build Unit test Go Report Card GitHub

Introduction

A project that was aimed at myself where i practiced golang programming. The goal was to add an alternative option to C++ it needed to be simple and easy to use. Any one who wishes to read contribute or review the code and provide suggestion is welcome to do so.

Table of Contents

Getting started

Prerequisites

The get everything running smoothy without any hiccups will requires some tools they might come preinstalled with your OS and if not I have listed the tools you will need to run service on your machine.

And then lastly a text editor of your choosing I recommend VS code but any text editor will do.

Standards

RFC

For more information as to how the application works please visit the following links to respective RFC standard with more information.

RFC Name url
2616 HTTP 1.1 RFC 2616
2818 HTTP over TLS RFC 2818
3339 Timestamps RFC 3339
3986 URI RFC 3986
4122 UUID RFC 4122
6455 Websocket RFC 6455
7159 JSON RFC 7159
5364 XML RFC 5364
7523 SOAP RFC 7523
7616 Digest Auth RFC 7616

Development

Continuing development on this service will require a couple of settings to be made for it to function properly.

Enable TLS

To enable TLS you will need to import a certificate(.crt) file and a private key both file should be added to the root folder. use the command bellow to generate self signed certificates in linux environment.

openssl req -newkey rsa:4096 \
            -x509 \
            -sha256 \
            -days 3650 \
            -nodes \
            -out server.crt \
            -keyout server.key

Keep in mind that openssl library must be installed in your system.

Editor Config

Make sure that you install Editor Config for your IDE before modifying the project and pushing github. This is to make it easier for all to read and modify your code.

Deployment

We make use of makefile in this project so deploying the service has been simplified allowing individuals with close to no knowledge the ability to deploy the service.

Docker

Configure variables

before you run the service make sure to go to the dockerfile and modify the "ENV" variables to your specification then go to the next step Build and run.

Variables

WS Discovery

If you are using an apple device make sure that stealth mode is disabled. If enabled a multicast broadcast will be sent to the network but all incoming response will be blocked.

Build and run

to deploy the service using docker is easy cake all you need to do is make sure that you have make installed. Once installed simply run "make build_docker" and then "make run_docker" and this will run the image.

Built With

The practice golang code was built with the following tools on GNU/Linux with Fedora 32 as distribution.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the GNU GENERAL PUBLIC V3 - see the LICENSE file for details

onvif's People

Contributors

nasar165 avatar

Stargazers

 avatar

onvif's Issues

Event handling

Add an event handler, the purpose is to log every incoming and outbound event from the server for tracking and debug/error handling.

Each event will be stored within a file located on the host PC where the client is running. If the client is running inside a docker container then please keep the log outside of the container or within a volume.

Code style

Add editorconfig to the project to help simplify the code style within the project allowing others to follow a specific set of code style

ws discovery payload for onvif devices

Is your feature request related to a problem? Please describe.
the ws discovery is missing onvif compliant payload.

Describe the solution you'd like
a simple function creating a soap payload for multicast broadcasting.

Describe alternatives you've considered
store payload within a file to be reused during runtime.

**To do **

  • implement ws-discovery payload that compatible with onvif.
  • add api end point requesting multicast broadcast that return the result
    • result may not take longer than 5s

Docker

docker container with docker-compose helping other developers to deploy the project with ease.

Docker Requirements:

  • Docker file
  • Docker Compose
  • scratch image (size optimized)
  • cache optimized (improve compile time)
  • import sensitive files using docker docs recommendation (--mount=type=secret)

Code Coverage

Is your feature request related to a problem? Please describe.
Unit test is an important part of this project allowing us as developers the ability to change, modify
and adjust the code base knowing that it will work after passing the test. This is really good but the
our issue is that there are edge cases that might not that obvious to everyone so It's important that we
as developers can know how much of our code base is being covered by our current unit tests .

Describe the solution you'd like
What this project needs is to implement a unit test coverage allowing us as developers to identify loop
holes and possible bugs that could have been missed due to us not being able to cover every single case.
a good start would be to add -coverprofile argument into the test command.

Describe alternatives you've considered
I have considered Codecov since the project is open source but that will require that an account is created
and maintained. This will also force us to depend on a third party provider that does not disclose their source code.

Additional context
No additional context or information.

SOAP

Implement SOAP protocol into the project. This protocol is critical for the projects success.

Http Server

Create a simple HTTP server the server:

  • server should be capable of setting it's own net listener
  • accepting a http handler before listening

Documentation

Add necessary documentation for newcomers, allowing a developer to easily pick up the code and begin contribute.

  • README.md
  • doc/example/README.md

ONVIF payload

Implement ONVIF payload processing for submitting request to ONVIF server (IP Camera). This issue will focus creating an ONVIF XML payload and will not handle the data submitted within the body.

XML parser

Implement XML parser with the following characteristics:

  • Capable of accepting an unknown payload
  • return error upon failure
  • return a string that contains XML data

CI Testing

Add GitHub action to the project, this shall be used to test the branch code before merging it into the main branch.

Digest authentication

Add digest authentication to the project, the issue will be considered complete when it is capable of processing the following:

  • username: stirng
  • password: sha1(nounce + timestamp + p)
  • nounce: random string (min 10 chars max 20)
  • timestamp: time.now (RFC3389-UTC)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.