aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/service/ipc_pipe.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-20 14:18:01 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-20 14:18:01 +0200
commitcdb8c53cdea8d8ac6e6f2112e4a5e844bffd01a4 (patch)
treedb88ec568dfc508da863e67164de909448c66742 /service/ipc_pipe.go
parentservice: move route monitor and account for changing index (diff)
downloadwireguard-windows-cdb8c53cdea8d8ac6e6f2112e4a5e844bffd01a4.tar.xz
wireguard-windows-cdb8c53cdea8d8ac6e6f2112e4a5e844bffd01a4.zip
service: split into tunnel and manager
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'service/ipc_pipe.go')
-rw-r--r--service/ipc_pipe.go77
1 files changed, 0 insertions, 77 deletions
diff --git a/service/ipc_pipe.go b/service/ipc_pipe.go
deleted file mode 100644
index ecf24716..00000000
--- a/service/ipc_pipe.go
+++ /dev/null
@@ -1,77 +0,0 @@
-/* SPDX-License-Identifier: MIT
- *
- * Copyright (C) 2019 WireGuard LLC. All Rights Reserved.
- */
-
-package service
-
-import (
- "os"
- "strconv"
-
- "golang.org/x/sys/windows"
-)
-
-type pipeRWC struct {
- reader *os.File
- writer *os.File
-}
-
-func (p *pipeRWC) Read(b []byte) (int, error) {
- return p.reader.Read(b)
-}
-
-func (p *pipeRWC) Write(b []byte) (int, error) {
- return p.writer.Write(b)
-}
-
-func (p *pipeRWC) Close() error {
- err1 := p.writer.Close()
- err2 := p.reader.Close()
- if err1 != nil {
- return err1
- }
- return err2
-}
-
-func makeInheritableAndGetStr(f *os.File) (str string, err error) {
- sc, err := f.SyscallConn()
- if err != nil {
- return
- }
- err2 := sc.Control(func(fd uintptr) {
- err = windows.SetHandleInformation(windows.Handle(fd), windows.HANDLE_FLAG_INHERIT, windows.HANDLE_FLAG_INHERIT)
- str = strconv.FormatUint(uint64(fd), 10)
- })
- if err2 != nil {
- err = err2
- }
- return
-}
-
-func inheritableEvents() (ourEvents *os.File, theirEvents *os.File, theirEventStr string, err error) {
- theirEvents, ourEvents, err = os.Pipe()
- if err != nil {
- return
- }
- theirEventStr, err = makeInheritableAndGetStr(theirEvents)
- return
-}
-
-func inheritableSocketpairEmulation() (ourReader *os.File, theirReader *os.File, theirReaderStr string, ourWriter *os.File, theirWriter *os.File, theirWriterStr string, err error) {
- ourReader, theirWriter, err = os.Pipe()
- if err != nil {
- return
- }
- theirWriterStr, err = makeInheritableAndGetStr(theirWriter)
- if err != nil {
- return
- }
-
- theirReader, ourWriter, err = os.Pipe()
- if err != nil {
- return
- }
- theirReaderStr, err = makeInheritableAndGetStr(theirReader)
- return
-}