github.com/iDigitalFlame/xmt@v0.5.4/com/pipe/xy_windows_no_crypt.go (about) 1 //go:build windows && !crypt 2 // +build windows,!crypt 3 4 // Copyright (C) 2020 - 2023 iDigitalFlame 5 // 6 // This program is free software: you can redistribute it and/or modify 7 // it under the terms of the GNU General Public License as published by 8 // the Free Software Foundation, either version 3 of the License, or 9 // any later version. 10 // 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License 17 // along with this program. If not, see <https://www.gnu.org/licenses/>. 18 // 19 20 package pipe 21 22 // PermEveryone is the SDDL string used in Windows Pipes to allow anyone to 23 // write and read to the listening Pipe 24 // 25 // This can be used for Pipe communication between privilege boundaries. 26 // 27 // Can be applied with the ListenPerm function. 28 const PermEveryone = "D:PAI(A;;FA;;;WD)(A;;FA;;;SY)" 29 30 var ( 31 // ErrTimeout is an error returned by the 'Dial*' functions when the 32 // specified timeout was reached when attempting to connect to a Pipe. 33 ErrTimeout = &errno{m: "connection timeout", t: true} 34 // ErrEmptyConn is an error received when the 'Listen' function receives a 35 // shortly lived Pipe connection. 36 // 37 // This error is only temporary and does not indicate any Pipe server failures. 38 ErrEmptyConn = &errno{m: "empty connection", t: true} 39 ) 40 41 // Format will ensure the path for this Pipe socket fits the proper OS based 42 // pathname. Valid path names will be returned without any changes. 43 func Format(s string) string { 44 if len(s) > 2 && s[0] == '\\' && s[1] == '\\' { 45 return s 46 } 47 return `\\.\pipe` + "\\" + s 48 }