Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Simon Ruderich <simon@ruderich.org>
To: wireguard@lists.zx2c4.com
Subject: [PATCH 4/7] helper_test: reorder DummyTUN functions to follow interface order
Date: Sun, 31 Dec 2017 17:16:51 +0100	[thread overview]
Message-ID: <329cb0dcf18e6a21b5579eb1c8f9a5855be05617.1514726309.git.simon@ruderich.org> (raw)
In-Reply-To: <cover.1514726309.git.simon@ruderich.org>
In-Reply-To: <cover.1514726309.git.simon@ruderich.org>

No code change. Makes it easier to compare the implementation with the
interface.

---
 src/helper_test.go | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/helper_test.go b/src/helper_test.go
index 8548121..46bb782 100644
--- a/src/helper_test.go
+++ b/src/helper_test.go
@@ -20,12 +20,10 @@ func (tun *DummyTUN) File() *os.File {
 	return nil
 }
 
-func (tun *DummyTUN) Name() string {
-	return tun.name
-}
-
-func (tun *DummyTUN) MTU() (int, error) {
-	return tun.mtu, nil
+func (tun *DummyTUN) Read(d []byte) (int, error) {
+	t := <-tun.packets
+	copy(d, t)
+	return len(t), nil
 }
 
 func (tun *DummyTUN) Write(d []byte) (int, error) {
@@ -33,18 +31,20 @@ func (tun *DummyTUN) Write(d []byte) (int, error) {
 	return len(d), nil
 }
 
-func (tun *DummyTUN) Close() error {
-	return nil
+func (tun *DummyTUN) MTU() (int, error) {
+	return tun.mtu, nil
+}
+
+func (tun *DummyTUN) Name() string {
+	return tun.name
 }
 
 func (tun *DummyTUN) Events() chan TUNEvent {
 	return tun.events
 }
 
-func (tun *DummyTUN) Read(d []byte) (int, error) {
-	t := <-tun.packets
-	copy(d, t)
-	return len(t), nil
+func (tun *DummyTUN) Close() error {
+	return nil
 }
 
 func CreateDummyTUN(name string) (TUNDevice, error) {
-- 
2.15.1

  parent reply	other threads:[~2017-12-31 16:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-31 16:16 [PATCH 0/7] TUN fixes Simon Ruderich
2017-12-31 16:16 ` [PATCH 1/7] tun: TUNDevice: document behavior of offset parameter Simon Ruderich
2017-12-31 16:16 ` [PATCH 2/7] tun_linux: add PIHeaderSize constant instead of magic value Simon Ruderich
2017-12-31 16:16 ` [PATCH 3/7] tun_linux: document packet information header values Simon Ruderich
2017-12-31 16:16 ` Simon Ruderich [this message]
2017-12-31 16:16 ` [PATCH 5/7] helper_test: adapt to TUNDevice interface change Simon Ruderich
2017-12-31 16:16 ` [PATCH 6/7] tun_darwin: " Simon Ruderich
2017-12-31 16:16 ` [PATCH 7/7] " Simon Ruderich
2017-12-31 19:17   ` Mathias Hall-Andersen
2018-01-01 11:14     ` Simon Ruderich
2018-01-01 11:36     ` Simon Ruderich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=329cb0dcf18e6a21b5579eb1c8f9a5855be05617.1514726309.git.simon@ruderich.org \
    --to=simon@ruderich.org \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).