-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
external-controller-pipe
for windows
maybe useful for electron and tauri client, node.js and rust still not support AF_UNIX on windows
- Loading branch information
Showing
7 changed files
with
96 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//go:build !windows | ||
|
||
package inbound | ||
|
||
import ( | ||
"net" | ||
"os" | ||
) | ||
|
||
const SupportNamedPipe = false | ||
|
||
func ListenNamedPipe(path string) (net.Listener, error) { | ||
return nil, os.ErrInvalid | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package inbound | ||
|
||
import ( | ||
"net" | ||
|
||
"github.com/metacubex/wireguard-go/ipc/namedpipe" | ||
"golang.org/x/sys/windows" | ||
) | ||
|
||
const SupportNamedPipe = true | ||
|
||
// windowsSDDL is the Security Descriptor set on the namedpipe. | ||
// It provides read/write access to all users and the local system. | ||
const windowsSDDL = "D:PAI(A;OICI;GWGR;;;BU)(A;OICI;GWGR;;;SY)" | ||
|
||
func ListenNamedPipe(path string) (net.Listener, error) { | ||
securityDescriptor, err := windows.SecurityDescriptorFromString(windowsSDDL) | ||
if err != nil { | ||
return nil, err | ||
} | ||
namedpipeLC := namedpipe.ListenConfig{ | ||
SecurityDescriptor: securityDescriptor, | ||
InputBufferSize: 256 * 1024, | ||
OutputBufferSize: 256 * 1024, | ||
} | ||
return namedpipeLC.Listen(path) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters