From: Josh Bleecher Snyder Date: Mon, 14 Dec 2020 21:30:38 +0000 (-0800) Subject: device: accept any io.Reader in device.IpcSetOperation X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e950ce7bd2ed1b32519f9877803f1b5b510b13c8;p=thirdparty%2Fwireguard-go.git device: accept any io.Reader in device.IpcSetOperation Any io.Reader will do, and there are no performance concerns here. This is technically backwards incompatible, but it is very unlikely to break any existing code. It is compatible with the existing uses in wireguard-{windows,android,apple} and also will allow us to slightly simplify it if desired. Signed-off-by: Josh Bleecher Snyder --- diff --git a/device/uapi.go b/device/uapi.go index 9f9c9bd..c0e522b 100644 --- a/device/uapi.go +++ b/device/uapi.go @@ -107,8 +107,8 @@ func (device *Device) IpcGetOperation(socket *bufio.Writer) error { return nil } -func (device *Device) IpcSetOperation(socket *bufio.Reader) error { - scanner := bufio.NewScanner(socket) +func (device *Device) IpcSetOperation(r io.Reader) error { + scanner := bufio.NewScanner(r) logError := device.log.Error logDebug := device.log.Debug