{"id":19653271,"url":"https://github.com/florianmichael/checkhost4j","last_synced_at":"2025-04-28T17:31:23.645Z","repository":{"id":172001758,"uuid":"641580046","full_name":"FlorianMichael/CheckHost4J","owner":"FlorianMichael","description":"Java implementation of the check-host.net API","archived":false,"fork":false,"pushed_at":"2025-04-14T15:05:08.000Z","size":368,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-23T04:09:07.766Z","etag":null,"topics":["check-host","checkhost","checkhostnet","http","ping","tcp","udp","web"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FlorianMichael.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"FlorianMichael","custom":["https://florianmichael.de/donate"]}},"created_at":"2023-05-16T19:14:54.000Z","updated_at":"2025-04-14T15:05:11.000Z","dependencies_parsed_at":"2023-11-19T07:23:21.389Z","dependency_job_id":"6661f7cf-eabb-4a3e-9e53-e74ce793b6a7","html_url":"https://github.com/FlorianMichael/CheckHost4J","commit_stats":null,"previous_names":["florianmichael/checkhost4j"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorianMichael%2FCheckHost4J","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorianMichael%2FCheckHost4J/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorianMichael%2FCheckHost4J/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorianMichael%2FCheckHost4J/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FlorianMichael","download_url":"https://codeload.github.com/FlorianMichael/CheckHost4J/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251355375,"owners_count":21576345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["check-host","checkhost","checkhostnet","http","ping","tcp","udp","web"],"created_at":"2024-11-11T15:13:44.563Z","updated_at":"2025-04-28T17:31:23.393Z","avatar_url":"https://github.com/FlorianMichael.png","language":"Java","readme":"# CheckHost4J\nJava implementation of the check-host.net API\n\n## Contact\nIf you encounter any issues, please report them on the [issue tracker](https://github.com/FlorianMichael/CheckHost4J/issues).  \nIf you just want to talk or need help with CheckHost4J feel free to join my [Discord](https://discord.gg/BwWhCHUKDf).\n\n## How to add this to your project\n### Gradle/Maven\nTo use CheckHost4J with Gradle/Maven you can use [Maven Central](https://mvnrepository.com/artifact/de.florianmichael/CheckHost4J), [Lenni0451's Maven](https://maven.lenni0451.net/#/releases/de/florianmichael/CheckHost4J) or [Jitpack](https://jitpack.io/#FlorianMichael/CheckHost4J).  \nYou can also find instructions how to implement it into your build script there.\n\n### Jar File\nIf you just want the latest jar file you can download it from the GitHub [Actions](https://github.com/FlorianMichael/CheckHost4J/actions) or use the [Release](https://github.com/FlorianMichael/CheckHost4J/releases).\n\nThis library requires you to have [Gson](https://mvnrepository.com/artifact/com.google.code.gson/gson/2.10.1) in your\nclass path\n\n## API Terminology\nThe API main class is `CheckHost4J`, it contains all the methods to interact with the API.\n\n```java\nfinal CheckHost4J checkHost = CheckHost4J.INSTANCE;\n```\n\nYou can either use the `CheckHost4J.INSTANCE` or create a new instance of `CheckHost4J` yourself, by creating\nan own instance you can define the `IRequester` yourself, which is used to send the requests to the API.\n\n```java\nfinal CheckHost4J checkHost = new CheckHost4J(...);\n```\n\nThe default `IRequester` is `JavaRequester`, which can be accessed via `JavaRequester.INSTANCE`, you can also\ncreate a new instance using `new JavaRequester(\"\u003cuser-agent\u003e\")`.\n\n```java\nfinal CheckHost4J checkHost = new CheckHost4J(new JavaRequester(\"MyUserAgent\"));\n```\n\nYou can use the methods `CheckHost4J#ping`, `CheckHost4J#http`, `CheckHost4J#tcpPort`, `CheckHost4J#udpPort`\nand `CheckHost4J#dns`\nto get a `ResultNode\u003cT\u003e` where T is the result type of the request (e.g. `PingResult`, `TCPResult`).\n\n```java\nfinal ResultNode\u003cPingResult\u003e pingResult = checkHost.ping(\"example.com\", 80 /* max nodes */);\n```\n\nAfter you got the `ResultNode\u003cT\u003e` you can use the `tickResults()` to update the `getResults()` list.\n\n```java\n// This will update the results list by sending the check-result request to the API,\n// This might not update all results, because some might not be finished yet\n// Which means you have to call this method multiple times to get all results (e.g. with a delay of 5 seconds)\npingResult.tickResults();\n\nfinal Map\u003cServerNode, PingResult\u003e results = pingResult.getResults();\nresults.forEach((serverNode, result) -\u003e {\n    if (result == null) { // All results which are not finished yet will be null\n        System.out.println(serverNode.name + \" is still checking...\");\n    } else if (result.getErrorMessage() != null) {\n        System.out.println(serverNode.name + \" failed: \" + result.getErrorMessage());\n    } else {\n        System.out.println(serverNode.name + \" responded: \" + result.getSuccessfulPings() + \"/\" + result.getTotalPings());\n    }\n});\n```\n\nYou can also get all the server nodes which are being checked by using the `getNodes()` method.\n\n```java\nfinal List\u003cServerNode\u003e nodes = pingResult.getNodes();\n```\n\nThe `de.florianmichael.checkhost4j.model.result` package contains all the result classes, which are used\nto store the result of the requests.\n\nTo get a list of all Request types you can use the `ResultType` enum.\n","funding_links":["https://github.com/sponsors/FlorianMichael","https://florianmichael.de/donate"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorianmichael%2Fcheckhost4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflorianmichael%2Fcheckhost4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorianmichael%2Fcheckhost4j/lists"}