{"id":21447877,"url":"https://github.com/hsbc/mu-cranker-router","last_synced_at":"2026-01-31T18:01:38.759Z","repository":{"id":40648764,"uuid":"506583676","full_name":"hsbc/mu-cranker-router","owner":"hsbc","description":"A library which allows you to easily create your own Cranker Router","archived":false,"fork":false,"pushed_at":"2025-03-14T03:21:18.000Z","size":1035,"stargazers_count":27,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-12T06:49:30.645Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","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/hsbc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2022-06-23T09:51:07.000Z","updated_at":"2025-03-14T03:21:22.000Z","dependencies_parsed_at":"2025-01-17T09:21:38.357Z","dependency_job_id":"e6b97025-9dfb-4977-b814-75497436a613","html_url":"https://github.com/hsbc/mu-cranker-router","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/hsbc/mu-cranker-router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsbc%2Fmu-cranker-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsbc%2Fmu-cranker-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsbc%2Fmu-cranker-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsbc%2Fmu-cranker-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hsbc","download_url":"https://codeload.github.com/hsbc/mu-cranker-router/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsbc%2Fmu-cranker-router/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28949274,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T14:26:55.697Z","status":"ssl_error","status_checked_at":"2026-01-31T14:26:52.545Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-23T03:12:31.516Z","updated_at":"2026-01-31T18:01:38.740Z","avatar_url":"https://github.com/hsbc.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"mu-cranker-router\n=================\n\nThis is a library which allows you to easily create your own Cranker Router. \n\nBackground\n----------\n\nCranker is a load-balancing reverse proxy that is designed for systems with many HTTP services that need to\nbe exposed at a single endpoint. It was designed for fast-moving teams that need to deploy early and often\nwith no central configuration needed when a new service is introduced or an existing one is upgraded.\n\nThe key difference with other reverse proxies and load balancers is that each service connects via a \"connector\"\nto one or more routers. This connection between connector and router is a websocket, and crucially it means\nthe service is self-configuring; the router knows where a service is and if it is available by the fact that\nit has an active websocket connection for a service.\n\nThe direction that connections are made between the load balancer and the services is also reversed: it is the\nservice that makes an HTTP (websocket) connection to the router, rather than the other way around. This allows\npatterns where services can be deployed on private networks, bound to localhost on ephemeral ports, with no\nopened incoming TCP ports into the network needed.\n\nThis library is an implementation of Cranker router that uses [mu-server](https://muserver.io) as the web server\nfor handling incoming requests.\n\nUsage\n-----\n\nAdd a dependency on `mu-cranker-router` and `mu-server`:\n\n````xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.hsbc.cranker\u003c/groupId\u003e\n    \u003cartifactId\u003emu-cranker-router\u003c/artifactId\u003e\n    \u003cversion\u003eRELEASE\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.muserver\u003c/groupId\u003e\n    \u003cartifactId\u003emu-server\u003c/artifactId\u003e\n    \u003cversion\u003eRELEASE\u003c/version\u003e\n\u003c/dependency\u003e\n````\n\nCranker Routers consist of two parts: an HTTPS server which clients send requests to, and a Web Socket server\nthat connectors register to.\n\nIn mu-cranker-router, you are responsible for creating both servers with mu-server (or a single server that does both).\n\nBecause you create your own Mu Server, you have full control over which HTTP or HTTPS port you open, the SSL config,\nHTTP2 config, authentication, and you can add handlers and filters etc. You can see Mu-Server documentation at \u003chttps://muserver.io/\u003e \nbut in a simple case, a server could look like the following:\n\n````java\npublic static void main(String[] args) {\n    \n    // Use the mucranker library to create a router object - this creates handlers\n    CrankerRouter router = CrankerRouterBuilder.crankerRouter()\n        .start();\n    \n    // Start a server which will listen to connector registrations on a websocket\n    MuServer registrationServer = MuServerBuilder.muServer()\n        .withHttpsPort(8444)\n        .addHandler(router.createRegistrationHandler())\n        .start();\n    \n    // Start the server that clients will send HTTP requests to\n    MuServer httpServer = MuServerBuilder.muServer()\n        .withHttpsPort(8443)\n        .addHandler(router.createHttpHandler())\n        .start();\n    \n    System.out.println(\"Cranker is available at \" + httpServer.uri() + \n                       \" with registration at \" + registrationServer.uri());\n}\n````\n\nTo try this, you can clone this repo and run the `RunLocal.java` class in `src/test/java`.\n\nSecurity Considerations\n-----------------------\n\nA router should only serve traffic from connectors that it trusts. This can be achieved in a number of ways, such as\n\n* firewall rules or IP validation which only allow TCP connections to the registration port from trusted sources, \n* mTLS (in which case client certificates should be enabled in the MuServerBuilder and verified in a handler), \n* or other HTTP authentication methods such as basic or token auth. \n\nTherefore, you may wish to add a handler before the registration handler which inspects the connection or request\ndetails of a registration request and either allows or rejects the registration. For example:\n\n```java\nMuServer registrationServer = MuServerBuilder.muServer()\n        .addHandler((req, resp) -\u003e {\n            // Authenticate registration requests here, e.g. based on client cert, IP address,\n            // shared secret in request headers, or any other HTTP authentication method as required.\n        })\n        .addHandler(router.createRegistrationHandler())\n        .start();\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsbc%2Fmu-cranker-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhsbc%2Fmu-cranker-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsbc%2Fmu-cranker-router/lists"}