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 <josh@tailscale.com>
This commit is contained in:
Josh Bleecher Snyder 2020-12-14 13:30:38 -08:00 committed by Jason A. Donenfeld
parent db1edc7e91
commit 93a4313c3a

View file

@ -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