Command-line network verification utility written in Rust.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Anthony J. Martinez 6fd9e6b351 Merge pull request 'Update deps and rev to 0.7.4' (#6) from update into main 2 weeks ago
src Bump deps, fix clippy lints 2 months ago
.gitignore Add support for parallel connection checking 8 months ago
Cargo.lock Update deps and rev to 0.7.4 2 weeks ago
Cargo.toml Update deps and rev to 0.7.4 2 weeks ago
LICENSE-APACHE Change license, update argument parsing. 6 months ago
LICENSE-MIT Change license, update argument parsing. 6 months ago Change license, update argument parsing. 6 months ago
example.toml Refactor extraneous Structs into one. Update 8 months ago



connchk is command-line network verification utility written in Rust. It aims to provide a cross platform utility that can verify if your host can reach targets defined in a TOML document. These hosts are checked in the following ways:

  • For plain TCP hosts, a TcpStream is opened or the relevant error is returned
  • For HTTP(S) hosts either
    • A basic check declares success if a status code of 200 is returned
    • A custom check declares success based on a user-defined status code for POSTs of given
      • Form encoded data, or
      • JSON body
    • In either case errors are returned to the user

The application expects exactly one argument which is the TOML document defining target hosts.

Starting in version 0.5.0, it is also possible to use connchk as a Rust library. Documentation is available here.


To get connchk run cargo install connchk on a system with Cargo installed.

Example TOML Config

# example.toml
kind = "Tcp"
desc = "GitLab SSH"
addr = ""

kind = "Tcp"
desc = "Freenode IRC"
addr = ""

kind = "Tcp"
desc = "httpbin IP endpoint"
addr = ""

# Posts as a form and reports success if the status code returned is 400
# which it will be for this bad request to this particular endpoint
kind = "Http"
desc = "httpbin POST endpoint (form)"
addr = ""
custom = { params = { someKey = "SpecialValue" }, ok = 400 } 

# Posts as JSON and reports success if the status code returned is 400
# as it will be for this particular endpoint
kind = "Http"
desc = "httpbin JSON endpoint"
addr = ""
custom = { json = { someKey = "SpecialValue" }, ok = 400 } 

# An example failure - this endpoing will return a 502 status code,
# but our configuration expects a 400 
kind = "Http"
desc = "httpbin JSON endpoint - Error"
addr = ""
custom = { json = { someKey = [3, "AnotherValue", false], anotherKey = { nested = "value", count = [1, 2, 3] } }, ok = 400 } 

Example Usage

$ ./connchk example.toml 
Successfully connected to GitLab SSH in 72ms
Successfully connected to Freenode IRC in 176ms
Successfully connected to httpbin IP endpoint in 648ms
Successfully connected to httpbin POST endpoint (form) in 666ms
Successfully connected to httpbin JSON endpoint in 647ms
Failed to connect to httpbin JSON endpoint - Error with: 
        Status: 502

JSON Bodies

The TOML structure of the configuration file maps on to JSON cleanly. Defining JSON bodies should be as easy as custom = { json = <Your JSON Here> }. While this was tested to a reasonable degree it's unlikely that every single possibility has been explored, so if issues are encountered please let it be known.

Major Changes

  • v0.7.0
    • Changes the project to dual license Apache 2.0 / MIT.
    • Adds a dependencies to clap for argument parsing.
  • v0.6.0
    • Refactored away TcpResource and HttpResource structs differentiating individual Resource kinds with the ResType enum
    • Added Resource.kind to hold ResType variants
    • Modified NetworkResources to hold Vec<Resources> in
    • Above changes are BREAKING with respect to all existing configuration files. Users should:
      • Replace all [[http]] or [[tcp]] lines with [[target]]
      • Add kind = "Http" to any block that previously stared with [[http]]
      • Add kind = "Tcp" to any block that previously stared with [[tcp]]
    • Updated dependencies in Cargo.toml & Cargo.lock
    • Added call latency to success output
    • Updated logic to maintain resource order when printing results
  • v0.5.0
    • Refactored to produce both binary and library crates
    • Created a common Resource struct to map TcpResource and HttpResources onto for consumption by par_iter() by rayon
    • The order in which success or failure messages are displayed may not be consistent with the order of definition in the TOML input file
  • v0.4.0
    • Adds use of rayon to support parallel connection execution
  • v0.3.0
    • Adds support for JSON post bodies.
    • Removes declaration of a "bad" status code. Custom tests define only the expected good status code.
  • v0.2.1 fixes error handling such that testing does not abort with the first failure
  • v0.2.0 disabled the default reqwest features to move the package to use of rustls instead of native-tls


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Copyright (C) 2020-2021 Anthony Martinez