Hi all,

I love go especially to write any server stuffs and wish if there was a
generic server stuff that inherits battle-tested code from net/http (proper
error handling, heuristic exponential backoff value working well in most
cases and Close/Shutdown operations that will be introduced in 1.8 and
more!).

I made it.

https://github.com/cat2neat/gtcp

gtcp is a TCP server framework not only that inherits battle-tested code
from net/http but can be extended through built-in interfaces and makes it
easy to write a keepalive protocol that cooperates with
server.Close|Shutdown and also makes it easy to write pipelining one.

The below are features.

### Features
- Can be used in the same manner with http.Server(>= 1.8).
  - Make API as much compatible as possible.
  - Make the zero value useful.
- Inherits as much battle tested code from net/http.
- Provides much flexiblity through built-in interfaces.
  - ConnHandler
    - ConnHandler
    - KeepAliveHandler that makes it easy to implement keepalive.
    - PipelineHandler that makes it easy to implement pipelining.
  - ConnTracker
    - MapConnTracker that handles force closing active connections also
graceful shutdown.
    - WGConnTracker that handles only graceful shutdown using a naive way
with sync.WaitGroup.
  - Conn
    - BufferedConn that wraps Conn in bufio.Reader/Writer.
    - StatsConn that wraps Conn to measure incoming/outgoing bytes.
    - DebugConn that wraps Conn to output debug information.
  - Logger
    - BuiltinLogger that logs using standard log package.
  - Retry
    - ExponentialRetry that implements exponential backoff algorithm
without jitter.
  - Statistics
    - TrafficStatistics that measures incomming/outgoing traffic across a
server.
  - Limiter
    - MaxConnLimiter that limits connections based on the maximum number.
- Gets GC pressure as little as possible with sync.Pool.
- Zero 3rd party dependencies.

I'm going to write some servers on top of gtcp so actively keep maintaining
as long as possible.

Any feedback, contributions or questions are appreciated.

cat2neat

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to