{"id":22835976,"url":"https://github.com/soypat/ether-swtch","last_synced_at":"2025-08-10T21:31:31.132Z","repository":{"id":57614947,"uuid":"380609059","full_name":"soypat/ether-swtch","owner":"soypat","description":"Low level Ethernet stack marshaller/unmarshaller for use in tiny places.","archived":true,"fork":false,"pushed_at":"2023-12-27T23:11:50.000Z","size":232,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-12T23:02:41.331Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soypat.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-26T22:45:33.000Z","updated_at":"2024-08-06T17:34:01.000Z","dependencies_parsed_at":"2024-12-12T23:02:02.530Z","dependency_job_id":"3aeb32d3-cda9-4f8e-b504-60fe3376439a","html_url":"https://github.com/soypat/ether-swtch","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/soypat/ether-swtch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soypat%2Fether-swtch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soypat%2Fether-swtch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soypat%2Fether-swtch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soypat%2Fether-swtch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soypat","download_url":"https://codeload.github.com/soypat/ether-swtch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soypat%2Fether-swtch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269793025,"owners_count":24476666,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-12-12T23:00:49.233Z","updated_at":"2025-08-10T21:31:30.836Z","avatar_url":"https://github.com/soypat.png","language":"Go","funding_links":[],"categories":["Embedded Systems"],"sub_categories":["Protocol implementations"],"readme":"# Archived\nNo longer maintained.\n\nSee seqs for a proper TCP/IP stack implementation: https://github.com/soypat/seqs\n\n# ether-swtch\nLow level Ethernet/IP/TCP/HTTP stack marshaller/unmarshaller for use in tiny places.\n\n\nBelow is an example of an HTTP server for the ENC28J60 integrated circuit using TinyGo. Works on the Arduino Mega 2560. Use build tag `-tags=noheap` to reduce heap allocations.\n```go\npackage main\n\nimport (\n    \"net\"\n\n    swtch \"github.com/soypat/ether-swtch\"\n    \"github.com/soypat/ether-swtch/hex\"\n)\n\nfunc main() {\n\tvar (\n\t\t// SPI Chip select pin. Can be any Digital pin.\n\t\tspiCS = machine.D53\n\t\tMAC   = net.HardwareAddr{0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xFF}\n\t\tMyIP  = net.IP{192, 168, 1, 5} //static setup is the only one available\n\t)\n\n\t// Configure writer/reader integrated circuit.\n\tdev := enc28j60.New(spiCS, machine.SPI0)\n\n\terr := dev.Init(MAC)\n\tif err != nil {\n\t\tprintln(err.Error())\n\t}\n\tconst okHeader = \"HTTP/1.0 200 OK\\r\\nContent-Type: text/html\\r\\nPragma: no-cache\\r\\n\\r\\n\"\n\ttimeout := time.Second * 1\n\t// Spin up HTTP server which responds with \"Hello world!\"\n\tswtch.HTTPListenAndServe(dev, MAC, MyIP, timeout, func(URL []byte) (response []byte) {\n\t\treturn []byte(okHeader + \"Hello world!\")\n\t}, printNonNilErr)\n}\n\nfunc printNonNilErr(err error) {\n\tif err != nil {\n\t\tprintln(err.Error())\n\t}\n}\n```\n\nWith `noheap` build tag enabled the above program consumes the following memory\n```\n   code    data     bss |   flash     ram\n  22278     765     856 |   23043    1621\n```\nThe program should be small enough to run on the Arduino UNO as well (2k sram, 32k flash).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoypat%2Fether-swtch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoypat%2Fether-swtch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoypat%2Fether-swtch/lists"}