{"id":19813863,"url":"https://github.com/azer0s/exu","last_synced_at":"2026-05-15T14:07:24.782Z","repository":{"id":194416989,"uuid":"690258132","full_name":"Azer0s/exu","owner":"Azer0s","description":"A simple network emulation library for Go","archived":false,"fork":false,"pushed_at":"2024-01-25T13:11:23.000Z","size":74,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T19:11:09.379Z","etag":null,"topics":["tuntap","vpn","vswitch"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Azer0s.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}},"created_at":"2023-09-11T21:07:16.000Z","updated_at":"2023-09-13T15:35:12.000Z","dependencies_parsed_at":"2024-01-23T00:27:02.747Z","dependency_job_id":"cc9481d2-68e5-4a10-be37-b4cc14833c8f","html_url":"https://github.com/Azer0s/exu","commit_stats":null,"previous_names":["azer0s/exu"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Azer0s/exu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azer0s%2Fexu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azer0s%2Fexu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azer0s%2Fexu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azer0s%2Fexu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Azer0s","download_url":"https://codeload.github.com/Azer0s/exu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azer0s%2Fexu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33068931,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["tuntap","vpn","vswitch"],"created_at":"2024-11-12T09:37:30.788Z","updated_at":"2026-05-15T14:07:24.766Z","avatar_url":"https://github.com/Azer0s.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# exu 🚞\n\nA simple network emulation library for Go.\n\n## Example - Two PCs connected to a switch\n\n```go\nsw1 := exu.NewVSwitch(\"sw1\", 10)\n\ndisconnectFn := func(p *exu.VPort) {\n    sw1.DisconnectPort(p)\n}\n\nconnectFn := func(port *exu.VPort) {\n    _ = sw1.ConnectToFirstAvailablePort(port)\n}\n\ngo exu.NewRemoteVport(6554, net.ParseIP(\"10.0.0.1\"), connectFn, disconnectFn)\ngo exu.NewRemoteVport(6555, net.ParseIP(\"10.0.0.2\"), connectFn, disconnectFn)\n\nselect {}\n```\n\n### On PC1\n\n```bash\npython3 -m http.server \u0026\ngo run exu/client/main.go localhost 6554\n```\n\n### On PC2\n\n```bash\nexport pc1_ip=\"address of PC1\"\ngo run exu/client/main.go $pc1_ip 6555\n```\n\nNow you can access `http://10.0.0.1:8000` from PC2.\n\n## Example - One PC connected to a router\n\n```go\nr1 := exu.NewVRouter(\"r1\", 10)\n\nr1 := exu.NewVRouter(\"r1\", 10)\np1 := r1.GetFirstFreePort()\nr1.SetPortIPNet(p1, net.IPNet{\n    IP:   net.IPv4(10, 0, 0, 1),\n    Mask: net.IPv4Mask(255, 255, 255, 0),\n})\n\n_, _ = exu.NewRemoteVport(6554, net.ParseIP(\"10.0.0.2\"), func(port *exu.VPort) {\n    _ = r1.ConnectPorts(p1, port)\n}, func(p *exu.VPort) {\n    log.Info(\"remote disconnected\")\n    r1.DisconnectPort(p1)\n})\n\nselect {}\n```\n\nOn PC1 you can run:\n\n```bash\nexu localhost 6554\n```\n\nAnd then ping the router:\n\n```bash\nping -4 10.0.0.1\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer0s%2Fexu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazer0s%2Fexu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer0s%2Fexu/lists"}