Code Monkey home page Code Monkey logo

go-intelowl's People

Contributors

eshaan7 avatar fear-the-reaper avatar mlodic avatar spiderxm avatar uzaxirr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-intelowl's Issues

Enhancing unit tests using gorilla/mux

Since we are using Go's httptest to simulate our IntelOwl server through by creating a mock test server from httptest.Server and using httptest.ServeMux as a router to implement our mock responses on the specified endpoint

Right now we need are initializing the test server with every test. By using gorilla/mux we can implement a request method-based router from which we only need to set up the test server once and keep using that for every test!

To implement a common setup and teardown we can use TestMain. For more information, you can read about it here.

Add basic project structure

Divide the project into a proper structure like pyintelowl. In this structure we will have the following:

  • intelowl
  • tests
  • examples
  • docs
  • .github
  • go.mod
  • README.md

intelowl

this directory will hold the service objects such Tags.go, Jobs.go

tests

this directory will hold the unit tests of each service

examples

this directory will hold a basic example and an advanced example on how to effectively use go-intel

docs

this directory will hold all of the documentation related to the project. Inspiration will be taken from pydragonfly

.github

This will hold the github actions for CI-CD

go.mod

This file will hold all the dependencies needed for project if any are required.

Add Error handling

  • Implement error handling by dividing the errors into a struct called intelOwlError

  • It will implement the go error interface so it's a proper Go error

Basic Concept

  • Dividing the errors into an error helps with not overcomplicating things by making several errors again and again
  • Simplifies things and is easy to maintain and scale
  • Easy methods to get the data and relevant JSON.

Turn Go-IntelOwl into a proper CLI as well like PyIntelOwl

Right now, Go-IntelOwl has only basic features. Are there any plans to turn it into a proper CLI? This would help us mature the library further as we go as we ourselves would come across multiple use cases related to this. I would love to help work this out if there are any plans.

Avoid repeatition of package name in function/variable names.

Since while accessing any property of a package, the client will write the package name, so there is no need to include package name in the content name.

e.g. in the file client.go, we have a struct named IntelOwlClientOptions. Whenever the client needs to access it, he/she writes :-

gointelowl.IntelOwlClientOptions{}

Here, the word IntelOwl is repeating 2 times! Instead, we can write :-

gointelowl.ClientOptions{}

The names of the contents of the package must be renamed to follow the conventions and avoid unneccessary long names.

Here is a screenshot from official golang blog

WhatsApp Image 2022-11-03 at 16 45 27

CI requirements

We should try to follow the same workflow of all the other projects:

  • using master branch only for pushing new releases from the develop branch
  • using develop branch as base repository and create new branches for new features from this branch
  • adding linters for go code
  • configure dependabot correctly
  • enable code-ql for go
  • enable them in github actions
  • others I could have missed

Break down each API endpoint to service objects

Separate the API endpoints to their specific resource and make a service object in separate files. Furthermore, provide optional struct parameters.

  • Separate the endpoints into service objects.
  • Add their optional structs.
  • Integrate context into the methods.

Break down the endpoints into services objects

Separate the API endpoints to their specific resource and make a service object in separate files. Furthermore, provide optional struct parameters.

  • Separate the endpoints into service objects
  • Add their optional structs

Adding a Constants.go

Like in Java we have Constants classes to keep all of your constants such as

  1. Endpoints
  2. Methods (GET, POST)
    It would be a good approach to add this as it is much more manageable, and idiomatic.

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.