{"id":16105795,"url":"https://github.com/devlights/go-tcp-keepalive-example","last_synced_at":"2025-04-06T03:13:23.618Z","repository":{"id":229755205,"uuid":"657487373","full_name":"devlights/go-tcp-keepalive-example","owner":"devlights","description":"This is a example of exchanging keep-alive probes by golang (SO_KEEPALIVE).","archived":false,"fork":false,"pushed_at":"2023-06-23T07:48:40.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-12T08:58:29.783Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devlights.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":"2023-06-23T07:05:55.000Z","updated_at":"2024-11-04T17:30:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ef7283f-8d7f-420a-995e-658a467c78f2","html_url":"https://github.com/devlights/go-tcp-keepalive-example","commit_stats":null,"previous_names":["devlights/go-tcp-keepalive-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fgo-tcp-keepalive-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fgo-tcp-keepalive-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fgo-tcp-keepalive-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fgo-tcp-keepalive-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devlights","download_url":"https://codeload.github.com/devlights/go-tcp-keepalive-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247427012,"owners_count":20937214,"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-10-09T19:10:39.353Z","updated_at":"2025-04-06T03:13:23.601Z","avatar_url":"https://github.com/devlights.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-tcp-keepalive-example\n\nThis is a example of exchanging keep-alive probes by golang (SO_KEEPALIVE).\n\n## Environments\n\n```sh\n$ lsb_release -a\nNo LSB modules are available.\nDistributor ID: Ubuntu\nDescription:    Ubuntu 22.04.2 LTS\nRelease:        22.04\nCodename:       jammy\n```\n\n```sh\n$ go version\ngo version go1.20.5 linux/amd64\n```\n\nThe sample code in this repository runs on both Windows and Linux.\n\n## Requirements\n\n### Task (go-task)\n\n```sh\n$ go install github.com/go-task/task/v3/cmd/task@latest\n```\n\n### tcpdump\n\n```sh\n$ sudo apt update\n$ sudo apt install -y tcpdump\n```\n\n## How to Run\n\nOpen three terminals. the first terminal, do the following\n\n```sh\n$ task capture\n```\n\nthe second terminal, do the following\n\n```sh\n$ task server\n```\n\nthe third terminal, do the following\n\n```sh\n$ task client\n```\n\nAfter a while, the first terminal outputs the following results.\n\nThe following is the result of a run on Gitpod.\n\n```sh\n$ task capture\ntask: [capture] sudo tcpdump -i lo 'tcp and port 12345 and tcp[13] \u0026 16 != 0 and tcp[12] \u0026 15 = 0'\ntcpdump: verbose output suppressed, use -v[v]... for full protocol decode\nlistening on lo, link-type EN10MB (Ethernet), snapshot length 262144 bytes\n07:42:59.109181 IP localhost.12345 \u003e localhost.57006: Flags [S.], seq 1096637414, ack 3661790707, win 43690, options [mss 65495,sackOK,TS val 1727619187 ecr 1727619187,nop,wscale 7], length 0\n07:42:59.109200 IP localhost.57006 \u003e localhost.12345: Flags [.], ack 1, win 342, options [nop,nop,TS val 1727619187 ecr 1727619187], length 0\n07:43:01.120277 IP localhost.57006 \u003e localhost.12345: Flags [.], ack 1, win 342, options [nop,nop,TS val 1727621199 ecr 1727619187], length 0\n07:43:01.120283 IP localhost.12345 \u003e localhost.57006: Flags [.], ack 1, win 342, options [nop,nop,TS val 1727621199 ecr 1727619187], length 0\n07:43:03.132273 IP localhost.57006 \u003e localhost.12345: Flags [.], ack 1, win 342, options [nop,nop,TS val 1727623211 ecr 1727621199], length 0\n07:43:03.132283 IP localhost.12345 \u003e localhost.57006: Flags [.], ack 1, win 342, options [nop,nop,TS val 1727623211 ecr 1727619187], length 0\n07:43:05.148284 IP localhost.57006 \u003e localhost.12345: Flags [.], ack 1, win 342, options [nop,nop,TS val 1727625227 ecr 1727623211], length 0\n07:43:05.148295 IP localhost.12345 \u003e localhost.57006: Flags [.], ack 1, win 342, options [nop,nop,TS val 1727625227 ecr 1727619187], length 0\n07:43:07.164286 IP localhost.57006 \u003e localhost.12345: Flags [.], ack 1, win 342, options [nop,nop,TS val 1727627243 ecr 1727625227], length 0\n07:43:07.164292 IP localhost.12345 \u003e localhost.57006: Flags [.], ack 1, win 342, options [nop,nop,TS val 1727627243 ecr 1727619187], length 0\n07:43:09.116306 IP localhost.57006 \u003e localhost.12345: Flags [F.], seq 1, ack 1, win 342, options [nop,nop,TS val 1727629195 ecr 1727627243], length 0\n07:43:09.116396 IP localhost.12345 \u003e localhost.57006: Flags [F.], seq 1, ack 2, win 342, options [nop,nop,TS val 1727629195 ecr 1727629195], length 0\n07:43:09.116440 IP localhost.57006 \u003e localhost.12345: Flags [.], ack 2, win 342, options [nop,nop,TS val 1727629195 ecr 1727629195], length 0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlights%2Fgo-tcp-keepalive-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevlights%2Fgo-tcp-keepalive-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlights%2Fgo-tcp-keepalive-example/lists"}