Description

Package bind provides a convenient way to bind to sockets. It exposes a flag in the default flag set named "bind" which provides syntax to bind TCP and UNIX sockets. It also supports binding to arbitrary file descriptors passed by a parent (for instance, systemd), and for binding to Einhorn sockets (including Einhorn ACK support).

If the value passed to bind contains a colon, as in ":8000" or "127.0.0.1:9001", it will be treated as a TCP address. If it begins with a "/" or a ".", it will be treated as a path to a UNIX socket. If it begins with the string "fd@", as in "[email protected]", it will be treated as a file descriptor (useful for use with systemd, for instance). If it begins with the string "einhorn@", as in "[email protected]", the corresponding einhorn socket will be used.

If an option is not explicitly passed, the implementation will automatically select between using "[email protected]", "[email protected]", and ":8000", depending on whether Einhorn or systemd (or neither) is detected.

This package is a teensy bit magical, and goes out of its way to Do The Right Thing in many situations, including in both development and production. If you're looking for something less magical, you'd probably be better off just calling net.Listen() the old-fashioned way.

bind is referenced in 21 repositories

github.com/zenazn/goji github.com/guregu/kami github.com/robxu9/kahinah

...