Giter VIP home page Giter VIP logo

ipaddrportslist's Introduction

ipaddrportslist

Explaining the supported values for that server config option about which interfaces and ports to listen on, or that bot config option about which servers to connect to.

  • Listen on a single port on localhost: Just put the number.

    • If types are a concern, supply any integer or a digit-only string.
  • Listen on any/all interfaces: *: + port number(s).

    • Specifies that you don't care about interfaces. Usually that results in listening on all available interfaces.
    • For multiple port numbers, see below.
  • For multiple values, separate them with at least one space.

    • You can safely put one comma before the spaces if you like to, or even between them. Spaces are any combination of " \t\r\n" = U+0020 space, U+0009 horizontal tab, U+000D carriage return and U+000A line feed.
  • Don't listen at all: - (Just put a hyphen-minus.)

    • Might be useful on servers that have additinal other means of interaction.
    • When encountered in a multi-value list, ignore the remaining values.
  • Listen on specific interface and ports: Put the interface (as hostname, IP.v4.addr.ess, [IP:v6:addr:ess] or *), a colon (:) and the port(s).

    • Separate multiple ports with comma (,), no spaces. Any space would separate the port from the interface, so it will be parsed as just a port number, as described above.
    • To include all ports of the previous address value, put a single _ U+005F low line) as the first port number.
    • To temporarily exclude (disable) a port number, put a single _ (U+005F low line) directly after it.

JavaScript Parser

An ipaddrportslist parser in JavaScript (ECMAScript) is provided in parser.js. For detailed examples see the test specs. Basic example:

var net = require('net'), ipAddrPortsList = require('ipaddrportslist'),
  listenAddrs = ipAddrPortsList(process.env.HELLOPORT || 2002);

listenAddrs.forEach(function listenOnAddr(lsnAddr) {
  var srv = net.createServer(), descr;
  /* ... handlers setup ... */
  srv.listen(lsnAddr.port, lsnAddr.host);
});

License

MIT

-- coding: utf-8, tab-width: 2 --

ipaddrportslist's People

Contributors

mk-pmb avatar

Watchers

 avatar  avatar

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.