Git Product home page Git Product logo

zoossh's Introduction

zoossh logo

Build Status

Overview

Zoossh is a Go parsing library for Tor-specific data formats. It can parse consensuses and server descriptors. I originally wrote zoossh as a speedy fundament for sybilhunter, a tool to find Sybils in the Tor network. I have no need for other file types, so if zoossh doesn't provide what you need, check out the libraries below.

Supported file formats

Zoossh partially supports the following two file formats:

  • Server descriptors (@type server-descriptor 1.0)
  • Network status consensuses (@type network-status-consensus-3 1.0)

For more information about file formats, have a look at CollecTor.

Examples

Here's how you can parse a network status document and iterate over all relay statuses:

consensus, err := zoossh.ParseConsensusFile(fileName)
if err != nil {
    // Handle error.
}

for status := range consensus.Iterate(nil) {
    fmt.Println(status)
}

Similarly, here's how you can parse a file containing server descriptors:

descriptors, err := zoossh.ParseDescriptorFile(fileName)
if err != nil {
    // Handle error.
}

for desc := range descriptors.Iterate(nil) {
    fmt.Println(desc)
}

For more details, have a look at zoossh's GoDoc page.

Alternatives

Check out the Python library Stem or the Java library metrics-lib. Both have more comprehensive support for data formats. There is also a comparison available online between Stem, metrics-lib, and zoossh.

Contact

Contact: Philipp Winter [email protected]
OpenPGP fingerprint: B369 E7A2 18FE CEAD EB96 8C73 CF70 89E3 D7FD C0D0

zoossh's People

Contributors

cmavromichalis avatar codelingobot avatar elimisteve avatar gtank avatar meskio avatar nullhypothesis avatar shanehowearth avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

zoossh's Issues

Implement lazy parsing

Often, only a small subset of an entire file must be parsed. In that case, it can pay off to have lazy parsing where content is parsed on access.

Parse consensus/descriptor from bytes or string

For making Tor analysis I parse consensuses and descriptors directly from tar.xz archive (from Collector). It would be great to have a public function to parse a descriptor from raw string (or []bytes). Another way would be to support tar.xz as it is commonly used on Collector, but first option would be more general. Making a temp file for every consensus/desciptor is simply too slow.

(Great lib anyway!)

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.