Skip to content

replacing wireguard go and creating amnezia start function per OS - #42

Merged
WendelHime merged 5 commits into
mainfrom
fix/replacing-wireguard-go
Sep 24, 2025
Merged

replacing wireguard go and creating amnezia start function per OS#42
WendelHime merged 5 commits into
mainfrom
fix/replacing-wireguard-go

Conversation

@WendelHime

Copy link
Copy Markdown
Contributor

No description provided.

The wireguard-go windows implementation doesn't implement with the same function signature as other OS implementations for the IPC package, this commit is creating a endpoint start function for windows and another for unix implementations with the hope that the IPC stuff is fixed. The windows IPC implementation create and manage pipe, the linux receives one as parameter
Comment thread transport/amnezia/endpoint_start_windows.go Outdated
@atavism

atavism commented Sep 24, 2025

Copy link
Copy Markdown

I'm getting this error trying to build macOS:

github.com/Jigsaw-Code/outline-sdk/x/smart
golang.org/x/mobile/internal/mobileinit
github.com/go-llsqlite/crawshaw
github.com/anacrolix/go-libutp
gobind/gobind
gobind/gobind
# gobind/gobind
panic: inlined function github.com/sagernet/sing/common.Map[go.shape.struct { ID string; Inbound string; InboundType string; IPVersion int32; Network string; Source string; Destination string; Domain string; Protocol string; User string; FromOutbound string; CreatedAt int64; ClosedAt int64; Uplink int64; Downlink int64; UplinkTotal int64; DownlinkTotal int64; Rule string; Outbound string; OutboundType string; ChainList []string },*go.shape.struct { ID string; Inbound string; InboundType string; IPVersion int32; Network string; Source string; Destination string; Domain string; Protocol string; User string; FromOutbound string; CreatedAt int64; ClosedAt int64; Uplink int64; Downlink int64; UplinkTotal int64; DownlinkTotal int64; Rule string; Outbound string; OutboundType string; ChainList []string }] missing func info

goroutine 1 [running]:
cmd/link/internal/ld.genInlTreeSym(0x1400015c000, 0x14000dd2c00?, {0x1400010e008, 0x14000132000, {0x10a73f4b3, 0x70, 0x70}, {0x4, 0x14, 0x3, ...}}, ...)
	cmd/link/internal/ld/pcln.go:212 +0x3c8
cmd/link/internal/ld.makeInlSyms(0x1400015c000, {0x14005468000, 0x101d4, 0x101d4?}, 0x14000dd2b70)
	cmd/link/internal/ld/pcln.go:235 +0x1a0
cmd/link/internal/ld.(*Link).pclntab(0x1400015c000, {0x14005356000?, 0x1400000e5d0?, 0xf?})
	cmd/link/internal/ld/pcln.go:839 +0x154
cmd/link/internal/ld.Main(_, {0x10, 0x20, 0x1, 0x1f, 0x1e, 0x7c00000, {0x0, 0x0, 0x0}, ...})
	cmd/link/internal/ld/main.go:430 +0x159c
main.main()
	cmd/link/main.go:72 +0xbb8
# gobind/gobind
panic: inlined function github.com/sagernet/sing/common.Map[go.shape.struct { ID string; Inbound string; InboundType string; IPVersion int32; Network string; Source string; Destination string; Domain string; Protocol string; User string; FromOutbound string; CreatedAt int64; ClosedAt int64; Uplink int64; Downlink int64; UplinkTotal int64; DownlinkTotal int64; Rule string; Outbound string; OutboundType string; ChainList []string },*go.shape.struct { ID string; Inbound string; InboundType string; IPVersion int32; Network string; Source string; Destination string; Domain string; Protocol string; User string; FromOutbound string; CreatedAt int64; ClosedAt int64; Uplink int64; Downlink int64; UplinkTotal int64; DownlinkTotal int64; Rule string; Outbound string; OutboundType string; ChainList []string }] missing func info

Do we need to update github.com/sagernet/sing?

@WendelHime

Copy link
Copy Markdown
Contributor Author

I'm getting this error trying to build macOS:

github.com/Jigsaw-Code/outline-sdk/x/smart
golang.org/x/mobile/internal/mobileinit
github.com/go-llsqlite/crawshaw
github.com/anacrolix/go-libutp
gobind/gobind
gobind/gobind
# gobind/gobind
panic: inlined function github.com/sagernet/sing/common.Map[go.shape.struct { ID string; Inbound string; InboundType string; IPVersion int32; Network string; Source string; Destination string; Domain string; Protocol string; User string; FromOutbound string; CreatedAt int64; ClosedAt int64; Uplink int64; Downlink int64; UplinkTotal int64; DownlinkTotal int64; Rule string; Outbound string; OutboundType string; ChainList []string },*go.shape.struct { ID string; Inbound string; InboundType string; IPVersion int32; Network string; Source string; Destination string; Domain string; Protocol string; User string; FromOutbound string; CreatedAt int64; ClosedAt int64; Uplink int64; Downlink int64; UplinkTotal int64; DownlinkTotal int64; Rule string; Outbound string; OutboundType string; ChainList []string }] missing func info

goroutine 1 [running]:
cmd/link/internal/ld.genInlTreeSym(0x1400015c000, 0x14000dd2c00?, {0x1400010e008, 0x14000132000, {0x10a73f4b3, 0x70, 0x70}, {0x4, 0x14, 0x3, ...}}, ...)
	cmd/link/internal/ld/pcln.go:212 +0x3c8
cmd/link/internal/ld.makeInlSyms(0x1400015c000, {0x14005468000, 0x101d4, 0x101d4?}, 0x14000dd2b70)
	cmd/link/internal/ld/pcln.go:235 +0x1a0
cmd/link/internal/ld.(*Link).pclntab(0x1400015c000, {0x14005356000?, 0x1400000e5d0?, 0xf?})
	cmd/link/internal/ld/pcln.go:839 +0x154
cmd/link/internal/ld.Main(_, {0x10, 0x20, 0x1, 0x1f, 0x1e, 0x7c00000, {0x0, 0x0, 0x0}, ...})
	cmd/link/internal/ld/main.go:430 +0x159c
main.main()
	cmd/link/main.go:72 +0xbb8
# gobind/gobind
panic: inlined function github.com/sagernet/sing/common.Map[go.shape.struct { ID string; Inbound string; InboundType string; IPVersion int32; Network string; Source string; Destination string; Domain string; Protocol string; User string; FromOutbound string; CreatedAt int64; ClosedAt int64; Uplink int64; Downlink int64; UplinkTotal int64; DownlinkTotal int64; Rule string; Outbound string; OutboundType string; ChainList []string },*go.shape.struct { ID string; Inbound string; InboundType string; IPVersion int32; Network string; Source string; Destination string; Domain string; Protocol string; User string; FromOutbound string; CreatedAt int64; ClosedAt int64; Uplink int64; Downlink int64; UplinkTotal int64; DownlinkTotal int64; Rule string; Outbound string; OutboundType string; ChainList []string }] missing func info

Do we need to update github.com/sagernet/sing?

I didn't saw this comment, thanks for bringing this @atavism I'll investigate but probably yes, it must be some version that wasn't updated

…tion to files with specific buid tags per OS
@garmr-ulfr

Copy link
Copy Markdown
Collaborator

@WendelHime I don't think github.com/getlantern/wireguard-go has been updated to support the amnezia IPC fields, has it? Until it is, we can't, and won't, be using amnezia. I still haven't heard anything from @myleshorton about whether we plan on doing that and when.

@WendelHime

Copy link
Copy Markdown
Contributor Author

@atavism yes we need to replace that module, but that must happen in lantern-outline

@WendelHime

WendelHime commented Sep 24, 2025

Copy link
Copy Markdown
Contributor Author

@WendelHime I don't think github.com/getlantern/wireguard-go has been updated to support the amnezia IPC fields, has it? Until it is, we can't, and won't, be using amnezia. I still haven't heard anything from @myleshorton about whether we plan on doing that and when.

@garmr-ulfr This PR is not to make amnezia works, but to unblock building lantern-outline versions for windows

@garmr-ulfr

Copy link
Copy Markdown
Collaborator

@atavism github.com/sagernet/sing should be replaced with github.com/getlantern/sing@lantern-main

@WendelHime
WendelHime marked this pull request as ready for review September 24, 2025 17:57
Copilot AI review requested due to automatic review settings September 24, 2025 17:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the wireguard-go implementation and introduces OS-specific UAPI (User-space API) socket handling for Amnezia transport functionality. The changes create platform-specific implementations for Windows and non-Windows systems to properly handle socket operations.

  • Introduces OS-specific UAPI socket handling with dedicated implementations for Windows and other platforms
  • Replaces direct wireguard-go IPC calls with abstracted uapiListen function
  • Updates dependencies to use a forked version of wireguard-go

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
transport/amnezia/uapi_windows.go Windows-specific UAPI socket listener implementation
transport/amnezia/uapi_other.go Non-Windows UAPI socket listener with file-based socket opening
transport/amnezia/endpoint_options.go Adds package documentation comment
transport/amnezia/endpoint.go Refactors UAPI socket handling to use new abstracted function
go.mod Updates wireguard-go dependency to forked version and reorganizes imports

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@garmr-ulfr garmr-ulfr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WendelHime
WendelHime merged commit b7ae595 into main Sep 24, 2025
1 check passed
@WendelHime
WendelHime deleted the fix/replacing-wireguard-go branch September 24, 2025 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants