Git Product home page Git Product logo

cproxy's Introduction

cproxy

High-performance TCP proxy implemented in C.

Usage

cproxy -l <local addr>:<local port> [-l <local addr>:<local port>...] 
       -r <remote addr>:<remote port> [-b <buf size>] [-n] [-t <num io threads>]
Arguments:
  -l <local addr>:<local port>: specify listen address and port
  -r <remote addr>:<remote port>: specify remote address and port
  -b <buf size>: specify session buffer size in bytes
  -n: enable TCP no delay
  -t: <num io threads>: specify number of I/O threads

Theory of Operation

  • 1 acceptor thread to accept incoming client connections.
  • Pool of 1 to N I/O threads to handle read, write, and connect operations. Pool size is configurable with -t option. Client sessions assigned to I/O threads using round robin.
  • 2 buffers per client session, one for each direction of traffic. Buffer size is configurable with -b option. Buffers are allocated from per-thread buffer pools in each I/O thread.
  • All sockets are non-blocking. All read, write, connect, and accept operations are asynchronous.
  • Automatically chooses between epoll, kqueue, and poll as the poll system call. epoll or kqueue are recommended because they allow storing pointers to connection state information in events passed to and from the kernel, eliminating lookup of state information every time through the event loop. If poll is used, connection state information is stored in a red-black tree from libavl 2.0.3.
  • kqueue is currently only supported on FreeBSD because that's the only platform I have access to test. It should also work on OS X and other BSDs.

cproxy's People

Contributors

aaronriekenberg 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.