Git Product home page Git Product logo

ocaml-socks's Introduction

ocaml-socks

Build status SOCKS 4a / SOCKS 5 library for OCaml clients and servers

This library implements functions for parsing and generating SOCKS 4A and SOCKS 5 requests and responses.

A Lwt helper module is provided to ease integration in Lwt applications. Unfortunately this module does not work with MirageOS.

Limitations

  • This is not a "SOCKS5 compliant" implementation since the RFC requires that compliant implementation MUST support GSSAPI, which this library does not.
  • The Lwt helper module does not handle BIND or UDP-associate.
  • The Lwt helper module does not implement client functionality. Eckhart Köppen has a fork that seems to implement this. A pull request to integrate this would be nice.

Building

To avoid always linking against Lwt/Async/MirageOS and introducing huge unneeded dependencies, this repository contains multiple OPAM packages:

  • socks
  • socks-lwt

A Makefile is provided for your convenience:

ocaml-socks$ make lib-lwt
ocaml-socks$ make docs
ocaml-socks$ make all
ocaml-socks$ make clean

Generating the documentation

This module is documented using mli docstrings. After installing the topkg-care OPAM package you can compile the documentation to HTML for viewing in your browser like this:

ocaml-socks$ make docs
# No parallelism done
Generated API doc in /home/user/ocaml/socks/_build/doc/api.docdir/

ocaml-socks$ firefox /home/user/ocaml/socks/_build/doc/api.docdir/index.html

Running a SOCKS server from utop

To run a SOCKS server listening on 127.0.0.1 (IPv4 localhost) port 1080 that accepts connections from IPv4/IPv6 localhost and connects to IPv4/IPv6/Domain-name ATYPs, you can use the easy_establish_server function:

let s = Socks_lwt.easy_establish_server () ;;
Lwt_main.run s ;;

The documentation for Socks_lwt has more details on creating filters for connecting clients.

Resources

The protocol description is included in this repository in the files

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.