{"id":22196835,"url":"https://github.com/cloudydeno/deno-socket_fetch","last_synced_at":"2025-07-27T01:30:40.225Z","repository":{"id":57675581,"uuid":"432320007","full_name":"cloudydeno/deno-socket_fetch","owner":"cloudydeno","description":"Remake of fetch() using Deno sockets, useful for niche usecases such as UNIX domain sockets","archived":false,"fork":false,"pushed_at":"2023-08-14T22:57:15.000Z","size":20,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-02T00:55:05.326Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://deno.land/x/socket_fetch","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudydeno.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-26T22:59:58.000Z","updated_at":"2023-07-11T01:51:51.000Z","dependencies_parsed_at":"2023-02-16T06:01:03.887Z","dependency_job_id":null,"html_url":"https://github.com/cloudydeno/deno-socket_fetch","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudydeno%2Fdeno-socket_fetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudydeno%2Fdeno-socket_fetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudydeno%2Fdeno-socket_fetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudydeno%2Fdeno-socket_fetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudydeno","download_url":"https://codeload.github.com/cloudydeno/deno-socket_fetch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227740670,"owners_count":17812687,"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":[],"created_at":"2024-12-02T14:16:40.286Z","updated_at":"2024-12-02T14:16:41.531Z","avatar_url":"https://github.com/cloudydeno.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Deno CI](https://github.com/cloudydeno/deno-socket_fetch/workflows/CI/badge.svg?branch=main)\n\n# `/x/socket_fetch`\n\n## What?\n\nA remake of some `fetch()` functionality in pure TypeScript,\nwith a set of pluggable `Dialer` implementations to customize\nhow network connections are established.\n\nSupport for:\n* `http:` over TCP\n* `https:` over TCP + TLS (with custom server name)\n* `http+unix:` over stream-type Unix Domain Sockets (UDS)\n\nNote that this module can \u0026 should be deprecated\nonce Deno's HTTP builtins provide comparable networking functionality.\n\n## Why?\n\nDeno's `fetch()` APIs are relatively limited for a server-side runtime.\nNumerous advanced network features have been lacking:\n\n* HTTP over UNIX domain sockets: https://github.com/denoland/deno/issues/8821\n* ~~HTTPS/TLS to IP addresses: https://github.com/denoland/deno/issues/7660~~\n  * Added in Deno v1.34 :)\n* ~~HTTPS with TLS client auth: https://github.com/denoland/deno/pull/11721~~\n  * Added in Deno v1.14 :)\n* HTTP with weird server behaviors that fail Deno's sanity checks\n\nUnfortunately, HTTP over UNIX domain sockets and HTTPS to IP addresses are both\nreally useful in modern/containerized cloud architecture.\nFor example, the Docker Engine listens **only** at `/var/run/docker.sock` by default,\nand Google Kubernetes Engine HTTPS APIs are **only** externally reachable via IP address.\n\nIn order to support connecting to these endpoints from various modules,\nI've opted to leverage Deno's TCP primitives directly in a new module.\n\n## When?\n\nConsider this library if you:\n\n* Need to send basic HTTP requests to a daemon that listens on a Unix socket\n  * Docker Engine, `tailscaled`, Podman, `snapd`, etc\n* Need to communicate with an HTTPS endpoint that doesn't have a proper DNS name\n  * Google Kubernetes Engine API, Kubernetes nodes/pods, IoT devices on your LAN\n  * You just need to provide any DNS name that **is** on the server's certificate\n* Need to use a service which has a different DNS name and TLS name\n  * I have no examples of this, and I hope you don't either.\n\n## Implemented features\n\n* Protocols:\n  * [x] `http:`\n  * [x] `https:`\n  * [x] `http+unix:`\n* HTTP/1.1 Requests:\n  * [x] Headers\n  * [ ] Buffered bodies\n  * [ ] Streaming bodies\n  * [ ] Connection keep-alive\n* HTTP/1.1 Responses:\n  * [x] Headers\n  * [x] Buffered bodies\n  * [ ] Streaming bodies\n\n### Remaining work\n\n* Rewrite with `/std/io/buffer.ts` (added in Deno v1.8.3)\n* Enable/test connection reuse\n* Implement error handling\n* Offer easy API for HTTP/1.1 upgrades, useful for Kubernetes SPDY\n* Support HTTP/2 when available (using `/x/spdy_transport`) for improved efficiency and accuracy\n\n## What about `WebSocket`?\nIn addition to the `fetch()` limitations listed above,\nDeno's `WebSocket` API is even further behind:\n\n* `WebSocket` doesn't accept `Deno.HttpClient`: https://github.com/denoland/deno/issues/11846\n  * Would enable custom Certificate Authorities\n  * Would enable TLS client certificate auth\n  * Should enable WebSocket over UNIX domain sockets, once `fetch()` has it\n* ~~`WebSocket` doesn't allow custom HTTP request headers: https://github.com/denoland/deno/issues/11847~~\n\nA [similar reimplementation effort already exists](https://deno.land/x/custom_socket/)\nfor `WebSocket` and so far it addresses custom request headers.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudydeno%2Fdeno-socket_fetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudydeno%2Fdeno-socket_fetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudydeno%2Fdeno-socket_fetch/lists"}