jayeshmahajan/cloud-devops-api

By jayeshmahajan

Updated almost 2 years ago

Developer Enablement for Devops Connection Check as an API

Image
Networking
Developer tools
Operating systems
21

100K+

jayeshmahajan/cloud-devops-api repository overview

Devops API for TCP and HTTP/HTTPS Connection test

This project provides a Flask-based API to check network connections for TCP and HTTP/HTTPS protocols. It performs DNS resolution, attempts to make connections, and returns detailed results in a JSON format.

Features:

  • TCP Connection Check: Verifies the ability to establish a TCP connection to a specified domain and port.

  • HTTP/HTTPS Connection Check: Verifies the ability to establish an HTTP/HTTPS connection to a specified domain.

  • DNS Resolution: Provides detailed DNS information including CNAME and all resolved IP addresses.

  • Pretty-Printed JSON Responses: Returns responses in a readable JSON format.

  • SSL Error Handling: Captures and returns detailed SSL errors.

  • Rate Limiting: Prevents attack on app server by adding rate limiting for accidental overload of app

Example usage

curl 'http://127.0.0.1:8080/check_connection?port=80&domain=example.com'

Response:

{
    "message": "TCP connection successful",
    "dns_result": {
        "cname": null,
        "ips": [
            "93.184.215.14"
        ]
    }
}

Check HTTP/HTTPS Connection URL: /check_http_connection

Method: GET

Parameters:

protocol: Protocol to check (http or https, optional, default is https) domain: Domain to check (required) timeout: Timeout for the connection in seconds (optional, default is 10) Example:

curl 'http://127.0.0.1:8080/check_http_connection?domain=www.google.com'

Respone:

{
    "message": "HTTP connection successful",
    "dns_result": {
        "cname": null,
        "ips": [
            "142.250.81.238"
        ]
    }
}

Error Handling The API handles various errors and returns detailed messages. Example errors include:

DNS Resolution Errors: When DNS resolution fails. TCP Connection Errors: When the TCP connection cannot be established. HTTP/HTTPS Connection Errors: When the HTTP/HTTPS connection fails, including SSL errors. Example Error Response

{
    "error": "DNS resolution failed: A DNS label is empty."
}

Tag summary

Content type

Image

Digest

sha256:7cc106775

Size

69.2 MB

Last updated

almost 2 years ago

docker pull jayeshmahajan/cloud-devops-api