Fixed tests

This commit is contained in:
Mathias Hall-Andersen
2018-02-02 20:45:25 +01:00
parent 4f97b52ea6
commit 5871ec04de
3 changed files with 35 additions and 22 deletions

View File

@@ -28,8 +28,8 @@ func (tun *DummyTUN) MTU() (int, error) {
return tun.mtu, nil
}
func (tun *DummyTUN) Write(d []byte) (int, error) {
tun.packets <- d
func (tun *DummyTUN) Write(d []byte, offset int) (int, error) {
tun.packets <- d[offset:]
return len(d), nil
}
@@ -41,9 +41,9 @@ func (tun *DummyTUN) Events() chan TUNEvent {
return tun.events
}
func (tun *DummyTUN) Read(d []byte) (int, error) {
func (tun *DummyTUN) Read(d []byte, offset int) (int, error) {
t := <-tun.packets
copy(d, t)
copy(d[offset:], t)
return len(t), nil
}