All Projects → up9inc → basenine

up9inc / basenine

Licence: Apache-2.0 license
Schema-free, document-oriented streaming database that optimized for monitoring network traffic in real-time

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to basenine

Perf Tools
⏱→ 🚀A set of tools for improving performance your application (balancer, performance, PerfKeeper, LazyPromise).
Stars: ✭ 135 (+255.26%)
Mutual labels:  traffic
Spectral Trajectory And Behavior Prediction
This is the code base for Trajectory and Driver Behavior Prediction in Autonomous Vehicles using Spectral Graph Theory
Stars: ✭ 236 (+521.05%)
Mutual labels:  traffic
ReshaperForBurp
Burp Suite Extension - Trigger actions and reshape HTTP request/response and WebSocket traffic using configurable rules
Stars: ✭ 32 (-15.79%)
Mutual labels:  traffic
Baidutraffic
This repo includes introduction, code and dataset of our paper Deep Sequence Learning with Auxiliary Information for Traffic Prediction (KDD 2018).
Stars: ✭ 143 (+276.32%)
Mutual labels:  traffic
Decept
Decept Network Protocol Proxy
Stars: ✭ 229 (+502.63%)
Mutual labels:  traffic
Wall-of-Shame
A framework for capturing user credentials and sensitive device information.
Stars: ✭ 57 (+50%)
Mutual labels:  traffic
Shadowsocks Hub
A web app managing shadowsocks users, servers, nodes, products, accounts, and traffic. Suitable for internal use by companies, organizations, and friends.
Stars: ✭ 118 (+210.53%)
Mutual labels:  traffic
promviz-front
Visualize Prometheus Metrics With Vizceral
Stars: ✭ 50 (+31.58%)
Mutual labels:  traffic
Horaires Ratp Api
Webservice pour les horaires et trafic RATP en temps réel
Stars: ✭ 232 (+510.53%)
Mutual labels:  traffic
trafficator
Traffic generator for local analytics testing
Stars: ✭ 27 (-28.95%)
Mutual labels:  traffic
Traffictoll
NetLimiter-like bandwidth limiting and QoS for Linux
Stars: ✭ 147 (+286.84%)
Mutual labels:  traffic
Youtubeshop
Youtube autolike and autosubs script
Stars: ✭ 177 (+365.79%)
Mutual labels:  traffic
website-fingerprinting
Deanonymizing Tor or VPN users with website fingerprinting and machine learning.
Stars: ✭ 59 (+55.26%)
Mutual labels:  traffic
Deep Qlearning Agent For Traffic Signal Control
A framework where a deep Q-Learning Reinforcement Learning agent tries to choose the correct traffic light phase at an intersection to maximize traffic efficiency.
Stars: ✭ 136 (+257.89%)
Mutual labels:  traffic
DTA
This repository documents MATLAB implementation of a dynamic user equilibrium solver, including a dynamic network loading sub-routine
Stars: ✭ 55 (+44.74%)
Mutual labels:  traffic
Kanaloa
Make your service more resilient by providing protection against traffic oversaturation
Stars: ✭ 129 (+239.47%)
Mutual labels:  traffic
Websockify
Websockify is a WebSocket to TCP proxy/bridge. This allows a browser to connect to any application/server/service.
Stars: ✭ 2,942 (+7642.11%)
Mutual labels:  traffic
flare
nRF905 single-chip radio transceiver demodulator + FLARM protocol decoder
Stars: ✭ 51 (+34.21%)
Mutual labels:  traffic
CoinHive
A nice friendly simple and easly customizable GUI for coinhives javascript miner to embed onto websites so users of your site can interact with features of the miner on every single page this javascript miner is to help those who have problems with advertisements/advertising/ads popups banners mobile redirects malvertising/malware etc and provid…
Stars: ✭ 58 (+52.63%)
Mutual labels:  traffic
vnstat-dashboard
A responsive web UI to view network traffic statistics provided by vnStat (with support for version 2.x)
Stars: ✭ 139 (+265.79%)
Mutual labels:  traffic

Basenine

GitHub Latest Release GitHub License GitHub Workflow Tests Code Coverage (Codecov)

Schema-free, document-oriented streaming database that optimized for monitoring network traffic in real-time.

Featured Aspects

  • Has the fastest possible write speed.
  • Has a read speed that scales linearly.
  • Schema-free.
  • Only allows create and read.
  • Accepts JSON as the record format.
  • Let's you query based on JSONPath.
  • Has a rich filtering syntax for querying.
  • Defines a TCP-based protocol.
  • Has long lasting TCP connections.
  • Watches the database and streams back the new records.

Server

Run the server:

make && ./basenine -port 9099

Protocol

The database server has these connection modes:

  • Insert mode is a long lasting TCP connection to insert data into the data_*.db binary files on server's directory. A client can elevate itself to insert mode by sending /insert command.

  • Insertion filter mode is a short lasting TCP connection that lets you set an insertion filter which is executed right before the insertion of each individual record. The default value of insertion filter is an empty string.

  • Query mode lets you filter the records in the database based on a filtering syntax named BFL. Query mode streams the results to the client and is able to keep up where it left off even if the database have millions of records. The TCP connection in this mode is long lasting as well. The filter cannot be changed without establishing a new connnection. The server also streams the query progress through /metadata command to the client.

  • Single mode is a short lasting TCP connection that returns a single record from the database based on the provided index value.

  • Fetch mode is a short lasting TCP connection mode for fetching N number of records from the database, starting from a certain offset, supporting both directions.

  • Validate mode checks the query against syntax errors. Returns the error if it's syntactically invalid otherwise returns OK.

  • Macro mode lets you define a macro for the query language like http~proto.name == "http".

  • Limit mode allows you to set a hard-limit for the database size in bytes like 100000000 (100MB). The disk usage ranges between 50000000 (50MB) and 100000000 (100MB). So the actual effective limit is the half of this value.

  • Flush mode is a short lasting TCP connection mode that removes all the records in the database.

  • Reset mode is a short lasting TCP connection mode that removes all the records in the database and resets the core into its initial state.

Query

Querying achieved through a filter syntax named Basenine Filter Language (BFL). It enables the user to query the traffic logs efficiently and precisely.

http and request.method == "GET" and request.path != "/example" and (request.query.a > 42 or request.headers["x"] == "y")

Please see the syntax reference for more info.

Client

Go

Insert

// Establish a new connection to a Basenine server at localhost:9099
c, err := NewConnection("localhost", "9099")
if err != nil {
    panic(err)
}

// Elevate to INSERT mode
c.InsertMode()

// There can be many Send and SendText calls
c.SendText(`{"brand":{"name":"Chevrolet"},"model":"Camaro","year":2019}`)
c.Send([]byte(`{"brand":{"name":"Chevrolet"},"model":"Camaro","year":2020}`))
c.SendText(`{"brand":{"name":"Chevrolet"},"model":"Camaro","year":2021}`)

// Close
c.Close()

Single

// Retrieve the record with ID equals to 42 with an empty query
// The 4th argument query, is only effective in case of
// record altering helpers like `redact` are used.
// Please refer the BFL syntax reference for more info.
data, err := Single("localhost", "9099", fmt.Sprintf("%024d", 42), "")
if err != nil {
    panic(err)
}

Fetch

// Retrieve up to 20 records starting from offset 100, in reverse direction (-1),
// with query `brand.name == "Chevrolet"` and with a 5 seconds timeout.
// Returns a slice of records, first meta and the latest meta state.
data, firstMeta, lastMeta, err := Fetch("localhost", "9099", 100, -1 `brand.name == "Chevrolet"`, 20, 5*time.Second)
if err != nil {
    panic(err)
}

Query

// Establish a new connection to a Basenine server at localhost:9099
c, err := NewConnection("localhost", "9099")
if err != nil {
    panic(err)
}

// Make []byte channels to recieve the data and the meta
data := make(chan []byte)
meta := make(chan []byte)

// Clean up
defer func() {
    data <- []byte(CloseChannel)
    meta <- []byte(CloseChannel)
    c.Close()
}()

// Define a function to handle the data stream
handleDataChannel := func(wg *sync.WaitGroup, c *Connection, data chan []byte) {
    defer wg.Done()
    for {
        bytes := <-data

        if string(bytes) == CloseChannel {
            return
        }

        // Do something with bytes
    }
}

// Define a function to handle the meta stream
handleMetaChannel := func(c *Connection, meta chan []byte) {
    for {
        bytes := <-meta

        if string(bytes) == CloseChannel {
            return
        }

        // Do something with bytes
    }
}

var wg sync.WaitGroup
go handleDataChannel(&wg, c, data)
go handleMetaChannel(c, meta)
wg.Add(1)

// The first argument can be an id, an empty string or "latest"
// to start the streaming from the latest record.
c.Query("", `brand.name == "Chevrolet"`, data, meta)

wg.Wait()

Validate

err := Validate("localhost", "9099", `brand.name == "Chevrolet"`)
if err != nil {
    // err should be nil, otherwise a connection error or a syntax error
}

Macro

// Define a macro `chevy` expands into `brand.name == "Chevrolet"`
err := Macro("localhost", "9099", "chevy", `brand.name == "Chevrolet"`)
if err != nil {
    // err can only be a connection error
}

Insertion Filter

// Set the insertion filter to `brand.name == "Chevrolet" and redact("year")`
err := InsertionFilter("localhost", "9099", `brand.name == "Chevrolet" and redact("year")`)
if err != nil {
    // err can only be a connection error
}

Limit

// Set the database size limit to 100MB
err := Limit("localhost", "9099", 100000000)
if err != nil {
    // err can only be a connection error
}

Flush

// Remove all the records
err := Flush("localhost", "9099")
if err != nil {
    // err can only be a connection error
}

Reset

// Reset the database into its initial state
err := Reset("localhost", "9099")
if err != nil {
    // err can only be a connection error
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].