All Projects → gihnius → Monconn

gihnius / Monconn

A TCP connection monitoring tool written in Go.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Monconn

jetson-monitor
🚨 Jetson is an HTTP monitoring service used to notify by various messaging platforms such as Slack and Telegram
Stars: ✭ 45 (-34.78%)
Mutual labels:  monitor, service
Pingtunnel
ping tunnel is a tool that advertises tcp/udp/socks5 traffic as icmp traffic for forwarding.
Stars: ✭ 1,904 (+2659.42%)
Mutual labels:  tcp, traffic
site-monitor
监控网站的可访问性的监控系统
Stars: ✭ 48 (-30.43%)
Mutual labels:  monitor, tcp
server-framework
纯C的分布式服务器框架通用模板,跨平台,模块动态加载,tcp/可靠UDP,协程RPC,日志,集群建立
Stars: ✭ 24 (-65.22%)
Mutual labels:  tcp, service
dynamic-engine
Monitor events in the background on Android.
Stars: ✭ 24 (-65.22%)
Mutual labels:  monitor, service
Quicklib
Quick development library (AutoMapper, LinQ, IOC Dependency Injection, MemoryCache, Scheduled tasks, Config, Serializers, etc) with crossplatform support for Delphi/Firemonkey (Windows,Linux,OSX/IOS/Android) and freepascal (Windows/Linux).
Stars: ✭ 274 (+297.1%)
Mutual labels:  service, monitor
Syncookied
syn flood protection
Stars: ✭ 274 (+297.1%)
Mutual labels:  tcp, traffic
Proximac
An open-source alternative to proxifier
Stars: ✭ 1,076 (+1459.42%)
Mutual labels:  tcp, traffic
Ruby Escper
Escper is a collection of essential tools that make printing of plain text and images to one or many serial thermal printers easy. Both USB and serial (RS232) printers are supported and detected automatically. Escper is useful for Ruby based Point of Sale systems that want to print receipts or tickets.
Stars: ✭ 64 (-7.25%)
Mutual labels:  tcp
Prism
Application Performance Management & Monitoring for iOS (APM)
Stars: ✭ 67 (-2.9%)
Mutual labels:  monitor
Skillbox Async Chat
Пример клиент-серверного чата на Python для Skillbox
Stars: ✭ 64 (-7.25%)
Mutual labels:  tcp
Pytcp
PyTCP is an attempt to create fully functional TCP/IP stack in Python. It supports TCP stream based transport with reliable packet delivery based on sliding window mechanism and basic congestion control. It also supports IPv6/ICMPv6 protocols with SLAAC address configuration. It operates as user space program attached to Linux TAP interface. As of today stack is able to send and receive traffic over Internet using IPv4 and IPv6 default gateways for routing. Since goal of this project is purely educational (at least at this point) the clarity of code is preferred over its efficiency. For the same reason security features are not being implemented just yet unless they are integral part of TCP/IP suite protocols specification.
Stars: ✭ 65 (-5.8%)
Mutual labels:  tcp
Gochat
goim server write by golang !🚀
Stars: ✭ 1,144 (+1557.97%)
Mutual labels:  tcp
Jonsnow
App Store/Google Play review watcher, deliver new reviews to slack channel
Stars: ✭ 65 (-5.8%)
Mutual labels:  monitor
Netassistant
A UDP/TCP Assistant. 网络调试助手
Stars: ✭ 66 (-4.35%)
Mutual labels:  tcp
Webterminal
ssh rdp vnc telnet sftp bastion/jump web putty xshell terminal jumpserver audit realtime monitor rz/sz 堡垒机 云桌面 linux devops sftp websocket file management rz/sz otp 自动化运维 审计 录像 文件管理 sftp上传 实时监控 录像回放 网页版rz/sz上传下载/动态口令 django
Stars: ✭ 1,124 (+1528.99%)
Mutual labels:  monitor
Mthawkeye
Profiling / Debugging assist tools for iOS. (Memory Leak, OOM, ANR, Hard Stalling, Network, OpenGL, Time Profile ...)
Stars: ✭ 1,119 (+1521.74%)
Mutual labels:  monitor
Automator
Various Automator and AppleScript workflow and scripts for simplifying life
Stars: ✭ 68 (-1.45%)
Mutual labels:  service
Videosniffer
视频嗅探服务(VideoSniffer API Service On Android)
Stars: ✭ 68 (-1.45%)
Mutual labels:  service
Traffic Rules Violation Detection
The System consists of two main components. Vehicle detection model and A graphical user interface (GUI)
Stars: ✭ 67 (-2.9%)
Mutual labels:  traffic

monconn

A TCP connection monitoring tool written in Go.

About

This is a tool(a library and a command line) for monitoring and debugging network services.

I built this for the purpose of facilitating debugging and monitoring the network connections of IoT devices. At this stage, it is just an experimental tool.

Note: For each tcp connection, an additional goroutine is used for monitoring, and uses a MonConn struct to store the monitored info, which takes up a bit more memory. For 5000 long connections, it takes up about 80~100MB of memory.

So it's not recommended to use it in high performance production environment.

features

  • reject remote ip by managing an ip blacklist
  • limit ip connections
  • record upload/download traffics of all connections
  • check idle tcp connection
  • show connecting ip connections count
  • show read and write bytes(hex array) on a connection
  • gracefull stop a tcp listener

Usage

Install

library:

go get -u -v github.com/gihnius/monconn

command line:

go get -u -v github.com/gihnius/monconn/cli/monconn

then run: monconn -h

Configuration

for library

import "github.com/gihnius/monconn"

// --------------- global setup
monconn.Debug = true // enable debug log
monconn.DebugFunc = func(format string, v ...interface{}) {
    // custom log function
}

// set net.Conn buffer size, default 4k
monconn.ReadBufSize = 4 << 10
monconn.WriteBufSize = 4 << 10

// set how many concurrency clients(ip) can connect to a service
// default 64
monconn.MaxIPLimit = 1000

// --------------- service setup
// set net.Conn read write timeout
service.ReadTimeout = 600
service.WriteTimeout = 600
// close wait timeout
service.WaitTimeout = 60
// max idle check in seconds
service.MaxIdle = 900
// connections count to a service, default 0, no limit
service.ConnLimit = 0 // ConnLimit changes need to restart service
// ips count to service, default 0, no limit
service.IPLimit = 0
// set tcp connection keepalive, default true
service.KeepAlive = true
// Print read write bytes in hex format, default false
service.PrintBytes = false

for command line

please checkout monconn/cli/monconn/config.yaml.

simple usage as a port forwarder:

# use as ssh and web frontend to monitor traffics
$ monconn -p :22=127.0.0.1:2222 -p 0.0.0.0:80=127.0.0.1:8080
# here 2222 and 8080 are the real ssh and web services

more configurable options:

# monconn config.yaml
service_1: # service name
  # service listen on
  listen_ip: "127.0.0.1"
  # monconn listen on 80
  listen_port: 80
  # forward requests to this backend
  backend_ip: "127.0.0.1"
  # the real web listen on 8080
  backend_port: 8080
  # service config
  read_timeout: 600 # 10 minutes
  write_timeout: 600 # 10 minutes
  wait_timeout: 60 # 1 minute
  max_idle: 900 # 15 minutes
  conn_limit: 0 # zero means no limit
  ip_limit: 0 # zero means no limit
  keepalive: true
  print_bytes: true
  ip_blacklist:
    - 1.1.1.1
    - 2.2.2.2

Example

// create service by given a sid: "127.0.0.1:1234"
// a service is binding to a tcp listener, so normally
// use a listen address as sid to identify a service
// you can also choose a uniqe string as sid.
service := monconn.NewService("127.0.0.1:1234")
// configure service like above
// service.ReadTimeout = ...
// listen a tcp port
// start the service monitor on ln
service.Listen("tcp", "127.0.0.1:1234")

// accept connection and monitor the connection
conn, err := service.AcquireConn()
if err != nil {
    // handle err
} else {
    go HandleConn(conn)
}

// when everything done, usually before program exit,
// call service.Stop() to stop the listener as well as service
service.Close()
// or call Shutdown() to Stop all services if there are multiple started.
monconn.Shutdown()

// or pls checkout the example code in examples/

// checkout the API to see how to grab the monitored infomation.

// ... that's all

API

monconn package api

  • NewService(sid) to create a service
  • GetService(sid) get service by sid
  • DelService(sid) delete a service
  • Shutdown() Stop all services

Service instance method

  • RejectIP(ip) add ip to blacklist
  • ReleaseIP(ip) remove ip from blacklist
  • Listen() start monitor the listener
  • AcquireConn() return monitored new connection
  • Close() stop service
  • WrapMonConn()
  • EliminateBytes(r, w) see godoc
  • ReadWriteBytes() return how many bytes read or write in a service
  • IPs() service's connecting ip
  • Uptime() service's uptime, in seconds
  • Sid() service's sid getter
  • AccessAt() latest client connect time
  • BootAt() service start from time
  • ConnCount() how many realtime connections
  • IPCount() realtime ips
  • Stats() json format stats
  • Log()

MonConn instance method

  • Idle() tell if client read idle
  • Stats()
  • Log()

see godoc

TODO

  • a session wrapper
  • improve logger
  • Implement ReadFrom and WriteTo methods

Status

In development (alpha).

License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].