Skip to content

sdsxpln/iotcpd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 

Repository files navigation

NAME
    iotcpd - a stdio to tcp redirector daemon

SYNOPSIS
    iotcpd --num-daemons 8 --daemon "squidGuard -c sg/adblock.conf" --ipv4 "10.20.30.40" --port "1234"

DESCRIPTION
    iotcpd is a generic STDIO to TCP redirector daemon. it can start multiple identical non-networking enabled daemons that only interact via stdin/stdout and query them based on requests received via TCP. the request is sent to the stdin of one of the daemons that is available and the reply from its stdout is then sent to the requester via TCP. the connection is then torn down.
    basically an inetd/xinetd/tcpserver on crack.
    epoll API functions are used to handle incoming connections.


example of how this fits in with having multiple squidguard daemons that can talk via TCP:

          ---------------------      ---- squidguard
         |                     |    |
---------+                     +----+---- squidguard
  TCP    |       iotcpd server |    |
          ---------------------      ...
                                    |
                                     ---- squidguard

 $ ./iotcpd --num-daemons 8 --daemon "squidGuard -c sg/adblock.conf" --ipv4 "10.20.30.40" --port "1234"

 dependencies
 - epoll aware OS (Linux >=2.6, FreeBSD)
 - >=net-proxy/squidguard-1.5_beta-r1
 - net-analyzer/netcat6 (from http://netcat6.sourceforge.net/) for testing


 how to compile/test

 $ make && ./iotcpd --num-daemons 8

  # in a different terminal
 $ bash test_adblock.sh a
 $ bash test_adblock.sh b
 $ bash test_adblock.sh c

 sending USR1 and USR2 signals will provide with detailed statistics on the innerworkings of the redirector service:

 $ kill -USR1 `pidof iotcpd`

 --- statistics ---- >8 -------
queries total      855997
queries replied    855992
queries delayed    24740
queries timeout    1085
queries failed     5
queries 0-100      657411
queries 100-250    179397
queries 250-500    16034
queries 500-750    1810
queries 750-1000   492
queries 1000-      343
daemon spawns      741
daemon S_AVAILABLE 27
daemon S_BUSY      5
daemon S_SPAWNING  0
daemon S_STARTING  0
uptime   7916
 --- statistics ---- 8< -------

 queries x-y represent a histogram of the replies based on the time their processing took (in miliseconds).

AUTHORS
    Petre Rodan <[email protected]>
    Cristian Sandu - pipe handling, a shoulder to cry on
    James White - patterns.sed used for converting adblock rules to squidguard expressions

COPYRIGHT
    the bundled code is under a BSD license. do whatever you want with it.

About

stdio to tcp redirector

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published