mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
chore: allow set security descriptor of namedpipe by environment variable LISTEN_NAMEDPIPE_SDDL
Some checks are pending
Trigger CMFA Update / trigger-CMFA-update (push) Waiting to run
Some checks are pending
Trigger CMFA Update / trigger-CMFA-update (push) Waiting to run
This commit is contained in:
parent
cd2d1c6bb0
commit
2afa2798b1
|
@ -2,6 +2,7 @@ package inbound
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/metacubex/wireguard-go/ipc/namedpipe"
|
"github.com/metacubex/wireguard-go/ipc/namedpipe"
|
||||||
"golang.org/x/sys/windows"
|
"golang.org/x/sys/windows"
|
||||||
|
@ -14,7 +15,11 @@ const SupportNamedPipe = true
|
||||||
const windowsSDDL = "D:PAI(A;OICI;GWGR;;;BU)(A;OICI;GWGR;;;SY)"
|
const windowsSDDL = "D:PAI(A;OICI;GWGR;;;BU)(A;OICI;GWGR;;;SY)"
|
||||||
|
|
||||||
func ListenNamedPipe(path string) (net.Listener, error) {
|
func ListenNamedPipe(path string) (net.Listener, error) {
|
||||||
securityDescriptor, err := windows.SecurityDescriptorFromString(windowsSDDL)
|
sddl := os.Getenv("LISTEN_NAMEDPIPE_SDDL")
|
||||||
|
if sddl == "" {
|
||||||
|
sddl = windowsSDDL
|
||||||
|
}
|
||||||
|
securityDescriptor, err := windows.SecurityDescriptorFromString(sddl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user