diff options
Diffstat (limited to 'tunnel/firewall/helpers.go')
-rw-r--r-- | tunnel/firewall/helpers.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tunnel/firewall/helpers.go b/tunnel/firewall/helpers.go index ee783c2d..79ab0d82 100644 --- a/tunnel/firewall/helpers.go +++ b/tunnel/firewall/helpers.go @@ -7,10 +7,12 @@ package firewall import ( "fmt" + "io" "os" "runtime" "syscall" "unsafe" + "crypto/rand" "golang.org/x/sys/windows" ) @@ -135,3 +137,15 @@ func getCurrentProcessAppID() (*wtFwpByteBlob, error) { } return appID, nil } + +func randGUID() (windows.GUID, error) { + guid := windows.GUID{} + n, err := rand.Read((*[16]byte)(unsafe.Pointer(&guid))[:]) + if err != nil { + return guid, err + } + if n != 16 { + return guid, io.ErrShortBuffer + } + return guid, nil +}
\ No newline at end of file |