<commit_before>***********************
asock
***********************
Automated socket module
#######################

Asock provides a fire-and-forget way to add plain socket interfaces to
servers written in Go. It handles network I/O and dispatches requests
from clients. All you need to do is watch its messaging channel for
events you'd like to log or act upon.

Current version: 0.12.0 (2015-03-28) (`Release notes <https://github.com/firepear/asock/blob/master/RELEASE_NOTES>`_)

What is it used for?
====================

Asock's original use case was administrative/backend interfaces over
Unix domain sockets — basically networked command lines.

Now TCP connections are supported as well, and input handling has been
made more flexible so that JSON or other structured data can be fed
into programs. So asock makes it easy to add call/response type
network interfaces to any piece of software. But that said…

Do not use asock on the internet!
---------------------------------

Asock is not yet secure or hardened. It does not support encryption,
and it has no concept of connection authentication, or rate-limiting,
or maximum transfer sizes. It is not currently safe to use on networks
which are publicly routable!

How is it used?
===============

::

    func hollaback(args [][]byte) ([]byte, error) {
        return args[0], nil
    }
    
    func set_things_up() {
        // populate a dispatch table
        d := make(asock.Dispatch)
        d["echo"] = &DispatchFunc{hollaback, "nosplit"}
        
        // instantiate a socket (/tmp/echosock or /var/run/echosock),
        // with no connection timeout, which will generate maximal
        // informational messages
        c := Config{"/tmp/echosock.sock", 0, asock.All}
        as, err := asock.NewUnix(c, d)
        
        // if err is nil, the socket is now up and handling requests.
        // if a client connects and sends a message beginning with
        // "echo", the rest of the message will be dispatched to
        // hollaback(). Its return value will then be sent to the client.
        ⋮
    }

    // ...then, in an eventloop elsewhere...
    select {
    case msg := <-as.Msgr:
        // Msgr is the message channel from asock. Handle
        // messages and error notifications here.
    case your_other_stuff:
        ⋮
    }

See the `package doc <http://godoc.org/firepear.net/asock>`_ for
complete information on setup options and usage.

Source and docs
===============

* Install with: :code:`go get firepear.net/asock`

* `Package documentation <http://godoc.org/firepear.net/asock>`_

* `Release notes <https://github.com/firepear/asock/blob/master/RELEASE_NOTES>`_)
  
* `Coverage report <http://firepear.net/asock/coverage.html>`_

* `Github <https://github.com/firepear/asock>`_<commit_msg>typos<commit_after>***********************
asock
***********************
Automated socket module
#######################

Asock provides a fire-and-forget way to add plain socket interfaces to
servers written in Go. It handles network I/O and dispatches requests
from clients. All you need to do is watch its messaging channel for
events you'd like to log or act upon.

Current version: 0.12.0 (2015-03-28) (`Release notes <https://github.com/firepear/asock/blob/master/RELEASE_NOTES>`_)

What is it used for?
====================

Asock's original use case was administrative/backend interfaces over
Unix domain sockets — basically networked command lines.

Now TCP connections are supported as well, and input handling has been
made more flexible so that JSON or other structured data can be fed
into programs. So asock makes it easy to add call/response type
network interfaces to any piece of software. But that said…

Do not use asock on the internet!
---------------------------------

Asock is not yet secure or hardened. It does not support encryption,
and it has no concept of connection authentication, or rate-limiting,
or maximum transfer sizes. It is not currently safe to use on networks
which are publicly routable!

How is it used?
===============

::

    func hollaback(args [][]byte) ([]byte, error) {
        return args[0], nil
    }
    
    func set_things_up() {
        // populate a dispatch table
        d := make(asock.Dispatch)
        d["echo"] = &DispatchFunc{hollaback, "nosplit"}
        
        // instantiate a socket (/tmp/echosock or /var/run/echosock),
        // with no connection timeout, which will generate maximal
        // informational messages
        c := Config{"/tmp/echosock.sock", 0, asock.All}
        as, err := asock.NewUnix(c, d)
        
        // if err is nil, the socket is now up and handling requests.
        // if a client connects and sends a message beginning with
        // "echo", the rest of the message will be dispatched to
        // hollaback(). Its return value will then be sent to the client.
        ⋮
    }

    // ...then, in an eventloop elsewhere...
    select {
    case msg := <-as.Msgr:
        // Msgr is the message channel from asock. Handle
        // messages and error notifications here.
    case your_other_stuff:
        ⋮
    }

See the `package doc <http://godoc.org/firepear.net/asock>`_ for
complete information on setup options and usage.

Source and docs
===============

* Install with: :code:`go get firepear.net/asock`

* `Package documentation <http://godoc.org/firepear.net/asock>`_

* `Release notes <https://github.com/firepear/asock/blob/master/RELEASE_NOTES>`_

* `Coverage report <http://firepear.net/asock/coverage.html>`_

* `Github <https://github.com/firepear/asock>`_
{'fraction_non_alphanumeric': 0.13953071825183594, 'fraction_numerical': 0.005015224789539674, 'mean_word_length': 2.974377224199288, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2032586', 'n_tokens_mistral': 1633, 'n_tokens_neox': 1536, 'n_words': 631}