From 6dab18f3d33a30438661128e5a5e76a5d9817cdd Mon Sep 17 00:00:00 2001 From: Matthias Frei Date: Thu, 19 Mar 2020 11:38:57 +0100 Subject: [PATCH 1/4] Rename UDPAddrFromString to ParseUDPAddr --- go/lib/snet/udpaddr.go | 6 +++--- go/lib/snet/udpaddr_test.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go/lib/snet/udpaddr.go b/go/lib/snet/udpaddr.go index f4a05c93b5..717510d39c 100644 --- a/go/lib/snet/udpaddr.go +++ b/go/lib/snet/udpaddr.go @@ -36,7 +36,7 @@ type UDPAddr struct { Host *net.UDPAddr } -// UDPAddrFromString converts an address string to a SCION address. +// ParseUDPAddr converts an address string to a SCION address. // The supported formats are: // // Recommended: @@ -53,7 +53,7 @@ type UDPAddr struct { // Not supported: // - isd-as,ipv6:port (caveat if ipv6:port builds a valid ipv6 address, // it will successfully parse as ipv6 without error) -func UDPAddrFromString(s string) (*UDPAddr, error) { +func ParseUDPAddr(s string) (*UDPAddr, error) { rawIA, rawHost, err := parseAddr(s) if err != nil { return nil, err @@ -111,7 +111,7 @@ func (a *UDPAddr) GetPath() (Path, error) { // Set implements the flag.Value interface func (a *UDPAddr) Set(s string) error { - other, err := UDPAddrFromString(s) + other, err := ParseUDPAddr(s) if err != nil { return err } diff --git a/go/lib/snet/udpaddr_test.go b/go/lib/snet/udpaddr_test.go index 95c86a4896..d6fef549d8 100644 --- a/go/lib/snet/udpaddr_test.go +++ b/go/lib/snet/udpaddr_test.go @@ -117,7 +117,7 @@ func TestUDPAddrSet(t *testing.T) { } } -func TestUDPAddrFromString(t *testing.T) { +func TestParseUDPAddr(t *testing.T) { tests := []struct { address string isError bool @@ -186,7 +186,7 @@ func TestUDPAddrFromString(t *testing.T) { } for _, test := range tests { t.Log(fmt.Sprintf("given address %q", test.address)) - a, err := snet.UDPAddrFromString(test.address) + a, err := snet.ParseUDPAddr(test.address) if test.isError { assert.Error(t, err) } else { From eeee353de83a013b65141c30928a3775fd3d341f Mon Sep 17 00:00:00 2001 From: Matthias Frei Date: Thu, 19 Mar 2020 14:25:44 +0100 Subject: [PATCH 2/4] Rename snet.SCIONPacket/Info to Packet/Info --- go/cs/beaconing/originator_test.go | 4 +-- go/cs/beaconing/propagator_test.go | 2 +- go/cs/keepalive/sender_test.go | 4 +-- go/cs/onehop/network.go | 6 ++-- go/cs/onehop/sender.go | 6 ++-- go/cs/onehop/sender_test.go | 6 ++-- go/integration/end2end/main.go | 8 ++--- go/lib/infra/infraenv/infraenv.go | 2 +- go/lib/sciond/pathprobe/paths.go | 4 +-- go/lib/snet/dispatcher.go | 6 ++-- go/lib/snet/mock_snet/snet.go | 4 +-- go/lib/snet/packet_conn.go | 26 +++++++-------- go/lib/snet/reader.go | 2 +- go/lib/snet/writer.go | 4 +-- go/lib/svc/mock_svc/svc.go | 2 +- go/lib/svc/resolver.go | 10 +++--- go/lib/svc/resolver_test.go | 20 ++++++------ go/lib/svc/svc.go | 8 ++--- go/lib/svc/svc_test.go | 52 +++++++++++++++--------------- 19 files changed, 88 insertions(+), 88 deletions(-) diff --git a/go/cs/beaconing/originator_test.go b/go/cs/beaconing/originator_test.go index 19b449a321..66ddc6de76 100644 --- a/go/cs/beaconing/originator_test.go +++ b/go/cs/beaconing/originator_test.go @@ -91,7 +91,7 @@ func TestOriginatorRun(t *testing.T) { msgsMtx.Lock() defer msgsMtx.Unlock() msgs = append(msgs, msg{ - pkt: ipkt.(*snet.SCIONPacket), + pkt: ipkt.(*snet.Packet), ov: iov.(*net.UDPAddr), }) return nil @@ -159,7 +159,7 @@ func TestOriginatorRun(t *testing.T) { } type msg struct { - pkt *snet.SCIONPacket + pkt *snet.Packet ov *net.UDPAddr } diff --git a/go/cs/beaconing/propagator_test.go b/go/cs/beaconing/propagator_test.go index b97989fa97..1b12b45fa2 100644 --- a/go/cs/beaconing/propagator_test.go +++ b/go/cs/beaconing/propagator_test.go @@ -194,7 +194,7 @@ func TestPropagatorRun(t *testing.T) { msgsMtx.Lock() defer msgsMtx.Unlock() msgs = append(msgs, msg{ - pkt: ipkt.(*snet.SCIONPacket), + pkt: ipkt.(*snet.Packet), ov: iov.(*net.UDPAddr), }) return nil diff --git a/go/cs/keepalive/sender_test.go b/go/cs/keepalive/sender_test.go index 511a9c4a3f..5d31d7aa32 100644 --- a/go/cs/keepalive/sender_test.go +++ b/go/cs/keepalive/sender_test.go @@ -61,10 +61,10 @@ func TestSenderRun(t *testing.T) { Signer: createTestSigner(t, priv), TopoProvider: topoProvider, } - pkts := make([]*snet.SCIONPacket, 0, len(topoProvider.Get().IFInfoMap())) + pkts := make([]*snet.Packet, 0, len(topoProvider.Get().IFInfoMap())) conn.EXPECT().WriteTo(gomock.Any(), gomock.Any()).Times(cap(pkts)).DoAndReturn( func(ipkts, _ interface{}) error { - pkts = append(pkts, ipkts.(*snet.SCIONPacket)) + pkts = append(pkts, ipkts.(*snet.Packet)) return nil }, ) diff --git a/go/cs/onehop/network.go b/go/cs/onehop/network.go index 0b3bf780d9..bf4648d09d 100644 --- a/go/cs/onehop/network.go +++ b/go/cs/onehop/network.go @@ -47,11 +47,11 @@ type ohpPacketConn struct { snet.PacketConn } -func (c *ohpPacketConn) WriteTo(pkt *snet.SCIONPacket, ov *net.UDPAddr) error { +func (c *ohpPacketConn) WriteTo(pkt *snet.Packet, ov *net.UDPAddr) error { return c.PacketConn.WriteTo( - &snet.SCIONPacket{ + &snet.Packet{ Bytes: pkt.Bytes, - SCIONPacketInfo: snet.SCIONPacketInfo{ + PacketInfo: snet.PacketInfo{ Destination: pkt.Destination, Source: pkt.Source, Path: pkt.Path, diff --git a/go/cs/onehop/sender.go b/go/cs/onehop/sender.go index 67b26621f6..fd92669f68 100644 --- a/go/cs/onehop/sender.go +++ b/go/cs/onehop/sender.go @@ -80,13 +80,13 @@ func (s *Sender) Send(msg *Msg, nextHop *net.UDPAddr) error { } // CreatePkt creates a scion packet with a one-hop path and the payload. -func (s *Sender) CreatePkt(msg *Msg) (*snet.SCIONPacket, error) { +func (s *Sender) CreatePkt(msg *Msg) (*snet.Packet, error) { path, err := s.CreatePath(msg.Ifid, msg.InfoTime) if err != nil { return nil, err } - pkt := &snet.SCIONPacket{ - SCIONPacketInfo: snet.SCIONPacketInfo{ + pkt := &snet.Packet{ + PacketInfo: snet.PacketInfo{ Destination: msg.Dst, Source: snet.SCIONAddress{ IA: s.IA, diff --git a/go/cs/onehop/sender_test.go b/go/cs/onehop/sender_test.go index 73818434b1..d7b1550dea 100644 --- a/go/cs/onehop/sender_test.go +++ b/go/cs/onehop/sender_test.go @@ -110,10 +110,10 @@ func TestSenderSend(t *testing.T) { } // Read from connection to unblock sender. ov := &net.UDPAddr{IP: net.IP{127, 0, 0, 42}, Port: 1337} - var pkt *snet.SCIONPacket + var pkt *snet.Packet conn.EXPECT().WriteTo(gomock.Any(), ov).DoAndReturn( func(ipkt, _ interface{}) error { - pkt = ipkt.(*snet.SCIONPacket) + pkt = ipkt.(*snet.Packet) return nil }, ) @@ -136,7 +136,7 @@ func testPacket() *Msg { } } -func checkTestPkt(t *testing.T, s *Sender, msg *Msg, pkt *snet.SCIONPacket) { +func checkTestPkt(t *testing.T, s *Sender, msg *Msg, pkt *snet.Packet) { SoMsg("dst", pkt.Destination, ShouldResemble, msg.Dst) SoMsg("src", pkt.Source, ShouldResemble, snet.SCIONAddress{ diff --git a/go/integration/end2end/main.go b/go/integration/end2end/main.go index 406ed483fd..ff0756b1c0 100644 --- a/go/integration/end2end/main.go +++ b/go/integration/end2end/main.go @@ -116,7 +116,7 @@ func (s server) run() { log.Debug("Listening", "local", fmt.Sprintf("%v:%d", integration.Local.Host, port)) // Receive ping message for { - var p snet.SCIONPacket + var p snet.Packet var ov net.UDPAddr if err := conn.ReadFrom(&p, &ov); err != nil { log.Error("Error reading packet", "err", err) @@ -210,8 +210,8 @@ func (c client) ping(ctx context.Context, n int) error { // API guarantees return values are ok _, _ = rand.Read(debugID[:]) return c.conn.WriteTo( - &snet.SCIONPacket{ - SCIONPacketInfo: snet.SCIONPacketInfo{ + &snet.Packet{ + PacketInfo: snet.PacketInfo{ Destination: snet.SCIONAddress{ IA: remote.IA, Host: addr.HostFromIP(remote.Host.IP), @@ -261,7 +261,7 @@ func (c client) getRemote(ctx context.Context, n int) error { func (c client) pong(ctx context.Context) error { c.conn.SetReadDeadline(getDeadline(ctx)) - var p snet.SCIONPacket + var p snet.Packet var ov net.UDPAddr if err := c.conn.ReadFrom(&p, &ov); err != nil { return common.NewBasicError("Error reading packet", err) diff --git a/go/lib/infra/infraenv/infraenv.go b/go/lib/infra/infraenv/infraenv.go index c7173d2ff9..b63d45f094 100644 --- a/go/lib/infra/infraenv/infraenv.go +++ b/go/lib/infra/infraenv/infraenv.go @@ -324,7 +324,7 @@ func InitInfraEnvironmentFunc(topologyPath string, f func()) { // inform local SCION state (CS informing the local SD). type ignoreSCMP struct{} -func (ignoreSCMP) Handle(pkt *snet.SCIONPacket) error { +func (ignoreSCMP) Handle(pkt *snet.Packet) error { // Always reattempt reads from the socket. return nil } diff --git a/go/lib/sciond/pathprobe/paths.go b/go/lib/sciond/pathprobe/paths.go index 51d6c22997..b85d1b07f8 100644 --- a/go/lib/sciond/pathprobe/paths.go +++ b/go/lib/sciond/pathprobe/paths.go @@ -182,7 +182,7 @@ type scmpHandler struct { statuses map[string]Status } -func (h *scmpHandler) Handle(pkt *snet.SCIONPacket) error { +func (h *scmpHandler) Handle(pkt *snet.Packet) error { hdr, ok := pkt.L4Header.(*scmp.Hdr) if ok { path, err := h.path(pkt) @@ -199,7 +199,7 @@ func (h *scmpHandler) Handle(pkt *snet.SCIONPacket) error { return nil } -func (h *scmpHandler) path(pkt *snet.SCIONPacket) (string, error) { +func (h *scmpHandler) path(pkt *snet.Packet) (string, error) { path := pkt.Path.Copy() if err := path.Reverse(); err != nil { return "", common.NewBasicError("unable to reverse path on received packet", err) diff --git a/go/lib/snet/dispatcher.go b/go/lib/snet/dispatcher.go index fbc23451c3..0bdebe34c5 100644 --- a/go/lib/snet/dispatcher.go +++ b/go/lib/snet/dispatcher.go @@ -76,7 +76,7 @@ type SCMPHandler interface { // // If the handler mutates the packet, the changes are seen by snet // connection method callers. - Handle(pkt *SCIONPacket) error + Handle(pkt *Packet) error } // NewSCMPHandler creates a default SCMP handler that forwards revocations to the revocation @@ -98,7 +98,7 @@ type scmpHandler struct { revocationHandler RevocationHandler } -func (h *scmpHandler) Handle(pkt *SCIONPacket) error { +func (h *scmpHandler) Handle(pkt *Packet) error { hdr, ok := pkt.L4Header.(*scmp.Hdr) if !ok { return common.NewBasicError("scmp handler invoked with non-scmp packet", nil, "pkt", pkt) @@ -119,7 +119,7 @@ func (h *scmpHandler) Handle(pkt *SCIONPacket) error { return nil } -func (h *scmpHandler) handleSCMPRev(hdr *scmp.Hdr, pkt *SCIONPacket) error { +func (h *scmpHandler) handleSCMPRev(hdr *scmp.Hdr, pkt *Packet) error { scmpPayload, ok := pkt.Payload.(*scmp.Payload) if !ok { return common.NewBasicError("Unable to type assert payload to SCMP payload", nil, diff --git a/go/lib/snet/mock_snet/snet.go b/go/lib/snet/mock_snet/snet.go index 21ef73f17f..a076844f13 100644 --- a/go/lib/snet/mock_snet/snet.go +++ b/go/lib/snet/mock_snet/snet.go @@ -327,7 +327,7 @@ func (mr *MockPacketConnMockRecorder) Close() *gomock.Call { } // ReadFrom mocks base method -func (m *MockPacketConn) ReadFrom(arg0 *snet.SCIONPacket, arg1 *net.UDPAddr) error { +func (m *MockPacketConn) ReadFrom(arg0 *snet.Packet, arg1 *net.UDPAddr) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ReadFrom", arg0, arg1) ret0, _ := ret[0].(error) @@ -383,7 +383,7 @@ func (mr *MockPacketConnMockRecorder) SetWriteDeadline(arg0 interface{}) *gomock } // WriteTo mocks base method -func (m *MockPacketConn) WriteTo(arg0 *snet.SCIONPacket, arg1 *net.UDPAddr) error { +func (m *MockPacketConn) WriteTo(arg0 *snet.Packet, arg1 *net.UDPAddr) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "WriteTo", arg0, arg1) ret0, _ := ret[0].(error) diff --git a/go/lib/snet/packet_conn.go b/go/lib/snet/packet_conn.go index fdf6e92a01..19fbad88c9 100644 --- a/go/lib/snet/packet_conn.go +++ b/go/lib/snet/packet_conn.go @@ -32,8 +32,8 @@ import ( // PacketConn gives applications easy access to writing and reading custom // SCION packets. type PacketConn interface { - ReadFrom(pkt *SCIONPacket, ov *net.UDPAddr) error - WriteTo(pkt *SCIONPacket, ov *net.UDPAddr) error + ReadFrom(pkt *Packet, ov *net.UDPAddr) error + WriteTo(pkt *Packet, ov *net.UDPAddr) error SetReadDeadline(t time.Time) error SetWriteDeadline(t time.Time) error SetDeadline(t time.Time) error @@ -68,17 +68,17 @@ func (b *Bytes) Prepare() { *b = (*b)[:cap(*b)] } -type SCIONPacket struct { +type Packet struct { Bytes - SCIONPacketInfo + PacketInfo } -// SCIONPacketInfo contains the data needed to construct a SCION packet. +// PacketInfo contains the data needed to construct a SCION packet. // // This is a high-level structure, and can only be used to create valid // packets. The documentation for each field specifies cases where // serialization might fail due to some violation of SCION protocol rules. -type SCIONPacketInfo struct { +type PacketInfo struct { // Destination contains the destination address. Destination SCIONAddress // Source contains the source address. If it is an SVC address, packet @@ -144,14 +144,14 @@ func (c *SCIONPacketConn) Close() error { return c.conn.Close() } -func (c *SCIONPacketConn) WriteTo(pkt *SCIONPacket, ov *net.UDPAddr) error { +func (c *SCIONPacketConn) WriteTo(pkt *Packet, ov *net.UDPAddr) error { StableSortExtensions(pkt.Extensions) hbh, e2e, err := hpkt.ValidateExtensions(pkt.Extensions) if err != nil { return common.NewBasicError("Bad extension list", err) } // TODO(scrye): scnPkt is a temporary solution. Its functionality will be - // absorbed by the easier to use SCIONPacket structure in this package. + // absorbed by the easier to use Packet structure in this package. scnPkt := &spkt.ScnPkt{ DstIA: pkt.Destination.IA, SrcIA: pkt.Source.IA, @@ -183,7 +183,7 @@ func (c *SCIONPacketConn) SetWriteDeadline(d time.Time) error { return c.conn.SetWriteDeadline(d) } -func (c *SCIONPacketConn) ReadFrom(pkt *SCIONPacket, ov *net.UDPAddr) error { +func (c *SCIONPacketConn) ReadFrom(pkt *Packet, ov *net.UDPAddr) error { for { // Read until we get an error or a data packet if err := c.readFrom(pkt, ov); err != nil { @@ -208,7 +208,7 @@ func (c *SCIONPacketConn) ReadFrom(pkt *SCIONPacket, ov *net.UDPAddr) error { } } -func (c *SCIONPacketConn) readFrom(pkt *SCIONPacket, ov *net.UDPAddr) error { +func (c *SCIONPacketConn) readFrom(pkt *Packet, ov *net.UDPAddr) error { pkt.Prepare() n, lastHopNetAddr, err := c.conn.ReadFrom(pkt.Bytes) if err != nil { @@ -229,7 +229,7 @@ func (c *SCIONPacketConn) readFrom(pkt *SCIONPacket, ov *net.UDPAddr) error { } // TODO(scrye): scnPkt is a temporary solution. Its functionality will be - // absorbed by the easier to use SCIONPacket structure in this package. + // absorbed by the easier to use Packet structure in this package. scnPkt := &spkt.ScnPkt{ DstIA: addr.IA{}, SrcIA: addr.IA{}, @@ -258,10 +258,10 @@ func (c *SCIONPacketConn) SetReadDeadline(d time.Time) error { } type SerializationOptions struct { - // If ComputeChecksums is true, the checksums in sent SCIONPackets are + // If ComputeChecksums is true, the checksums in sent Packets are // recomputed. Otherwise, the checksum value is left intact. ComputeChecksums bool - // If FixLengths is true, any lengths in sent SCIONPackets are recomputed + // If FixLengths is true, any lengths in sent Packets are recomputed // to match the data contained in payloads/inner layers. This currently // concerns extension headers and the L4 header. FixLengths bool diff --git a/go/lib/snet/reader.go b/go/lib/snet/reader.go index 802704e4e5..4441d8e3ef 100644 --- a/go/lib/snet/reader.go +++ b/go/lib/snet/reader.go @@ -65,7 +65,7 @@ func (c *scionConnReader) read(b []byte) (int, *UDPAddr, error) { c.mtx.Lock() defer c.mtx.Unlock() - pkt := SCIONPacket{ + pkt := Packet{ Bytes: Bytes(c.buffer), } var lastHop net.UDPAddr diff --git a/go/lib/snet/writer.go b/go/lib/snet/writer.go index 5a405a68e2..1b94ba5d9f 100644 --- a/go/lib/snet/writer.go +++ b/go/lib/snet/writer.go @@ -73,9 +73,9 @@ func (c *scionConnWriter) WriteTo(b []byte, raddr net.Addr) (int, error) { "addr", fmt.Sprintf("%v(%T)", a, a)) } - pkt := &SCIONPacket{ + pkt := &Packet{ Bytes: Bytes(c.buffer), - SCIONPacketInfo: SCIONPacketInfo{ + PacketInfo: PacketInfo{ Destination: dst, Source: SCIONAddress{IA: c.base.scionNet.localIA, Host: addr.HostFromIP(c.base.listen.IP)}, diff --git a/go/lib/svc/mock_svc/svc.go b/go/lib/svc/mock_svc/svc.go index c89679c267..9fd8eaac3f 100644 --- a/go/lib/svc/mock_svc/svc.go +++ b/go/lib/svc/mock_svc/svc.go @@ -75,7 +75,7 @@ func (m *MockRoundTripper) EXPECT() *MockRoundTripperMockRecorder { } // RoundTrip mocks base method -func (m *MockRoundTripper) RoundTrip(arg0 context.Context, arg1 snet.PacketConn, arg2 *snet.SCIONPacket, arg3 *net.UDPAddr) (*svc.Reply, error) { +func (m *MockRoundTripper) RoundTrip(arg0 context.Context, arg1 snet.PacketConn, arg2 *snet.Packet, arg3 *net.UDPAddr) (*svc.Reply, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RoundTrip", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*svc.Reply) diff --git a/go/lib/svc/resolver.go b/go/lib/svc/resolver.go index 8adbc2c2b8..2256c871ef 100644 --- a/go/lib/svc/resolver.go +++ b/go/lib/svc/resolver.go @@ -75,8 +75,8 @@ func (r *Resolver) LookupSVC(ctx context.Context, p snet.Path, svc addr.HostSVC) return nil, common.NewBasicError(errRegistration, err) } - requestPacket := &snet.SCIONPacket{ - SCIONPacketInfo: snet.SCIONPacketInfo{ + requestPacket := &snet.Packet{ + PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{ IA: r.LocalIA, Host: addr.HostFromIP(r.LocalIP), @@ -106,7 +106,7 @@ func (r *Resolver) getRoundTripper() RoundTripper { // connection, using the specified request packet and overlay address. type RoundTripper interface { // RoundTrip performs the round trip interaction. - RoundTrip(ctx context.Context, c snet.PacketConn, request *snet.SCIONPacket, + RoundTrip(ctx context.Context, c snet.PacketConn, request *snet.Packet, ov *net.UDPAddr) (*Reply, error) } @@ -120,7 +120,7 @@ var _ RoundTripper = (*roundTripper)(nil) type roundTripper struct{} -func (roundTripper) RoundTrip(ctx context.Context, c snet.PacketConn, pkt *snet.SCIONPacket, +func (roundTripper) RoundTrip(ctx context.Context, c snet.PacketConn, pkt *snet.Packet, ov *net.UDPAddr) (*Reply, error) { cancelF := ctxconn.CloseConnOnDone(ctx, c) @@ -137,7 +137,7 @@ func (roundTripper) RoundTrip(ctx context.Context, c snet.PacketConn, pkt *snet. return nil, common.NewBasicError(errWrite, err) } - var replyPacket snet.SCIONPacket + var replyPacket snet.Packet var replyOv net.UDPAddr if err := c.ReadFrom(&replyPacket, &replyOv); err != nil { return nil, common.NewBasicError(errRead, err) diff --git a/go/lib/svc/resolver_test.go b/go/lib/svc/resolver_test.go index f063e131d1..fa6460b2da 100644 --- a/go/lib/svc/resolver_test.go +++ b/go/lib/svc/resolver_test.go @@ -87,7 +87,7 @@ func TestRoundTripper(t *testing.T) { } testCases := []struct { Description string - InputPacket *snet.SCIONPacket + InputPacket *snet.Packet InputOverlay *net.UDPAddr ExpectedError bool ExpectedReply *svc.Reply @@ -100,12 +100,12 @@ func TestRoundTripper(t *testing.T) { }, { Description: "nil overlay returns error", - InputPacket: &snet.SCIONPacket{}, + InputPacket: &snet.Packet{}, ExpectedError: true, }, { Description: "if write fails, return error", - InputPacket: &snet.SCIONPacket{}, + InputPacket: &snet.Packet{}, InputOverlay: &net.UDPAddr{}, ExpectedError: true, ConnSetup: func(c *mock_snet.MockPacketConn) { @@ -114,7 +114,7 @@ func TestRoundTripper(t *testing.T) { }, { Description: "if read fails, return error", - InputPacket: &snet.SCIONPacket{}, + InputPacket: &snet.Packet{}, InputOverlay: &net.UDPAddr{}, ExpectedError: true, ConnSetup: func(c *mock_snet.MockPacketConn) { @@ -124,13 +124,13 @@ func TestRoundTripper(t *testing.T) { }, { Description: "if bad payload type, return error", - InputPacket: &snet.SCIONPacket{}, + InputPacket: &snet.Packet{}, InputOverlay: &net.UDPAddr{}, ExpectedError: true, ConnSetup: func(c *mock_snet.MockPacketConn) { c.EXPECT().WriteTo(gomock.Any(), gomock.Any()).Return(nil) c.EXPECT().ReadFrom(gomock.Any(), gomock.Any()).DoAndReturn( - func(pkt *snet.SCIONPacket, _ *net.UDPAddr) error { + func(pkt *snet.Packet, _ *net.UDPAddr) error { pkt.Payload = &ctrl.SignedPld{} return nil }, @@ -139,13 +139,13 @@ func TestRoundTripper(t *testing.T) { }, { Description: "if reply cannot be parsed, return error", - InputPacket: &snet.SCIONPacket{}, + InputPacket: &snet.Packet{}, InputOverlay: &net.UDPAddr{}, ExpectedError: true, ConnSetup: func(c *mock_snet.MockPacketConn) { c.EXPECT().WriteTo(gomock.Any(), gomock.Any()).Return(nil) c.EXPECT().ReadFrom(gomock.Any(), gomock.Any()).DoAndReturn( - func(pkt *snet.SCIONPacket, _ *net.UDPAddr) error { + func(pkt *snet.Packet, _ *net.UDPAddr) error { pkt.Payload = common.RawBytes{42} return nil }, @@ -154,12 +154,12 @@ func TestRoundTripper(t *testing.T) { }, { Description: "successful operation", - InputPacket: &snet.SCIONPacket{}, + InputPacket: &snet.Packet{}, InputOverlay: &net.UDPAddr{}, ConnSetup: func(c *mock_snet.MockPacketConn) { c.EXPECT().WriteTo(gomock.Any(), gomock.Any()).Return(nil) c.EXPECT().ReadFrom(gomock.Any(), gomock.Any()).DoAndReturn( - func(pkt *snet.SCIONPacket, _ *net.UDPAddr) error { + func(pkt *snet.Packet, _ *net.UDPAddr) error { buf := &bytes.Buffer{} if err := testReply.SerializeTo(buf); err != nil { panic(err) diff --git a/go/lib/svc/svc.go b/go/lib/svc/svc.go index 88643b0a5e..87b70d3ac5 100644 --- a/go/lib/svc/svc.go +++ b/go/lib/svc/svc.go @@ -101,7 +101,7 @@ type resolverPacketConn struct { handler RequestHandler } -func (c *resolverPacketConn) ReadFrom(pkt *snet.SCIONPacket, ov *net.UDPAddr) error { +func (c *resolverPacketConn) ReadFrom(pkt *snet.Packet, ov *net.UDPAddr) error { for { if err := c.PacketConn.ReadFrom(pkt, ov); err != nil { return err @@ -155,7 +155,7 @@ type Request struct { Source snet.SCIONAddress // Conn is the connection to send the reply on. Conn must not be nil. Conn snet.PacketConn - Packet *snet.SCIONPacket + Packet *snet.Packet Overlay *net.UDPAddr } @@ -175,8 +175,8 @@ func (h *BaseHandler) Handle(request *Request) (Result, error) { return Error, err } l4header := h.reverseL4Header(request.Packet.L4Header) - replyPacket := &snet.SCIONPacket{ - SCIONPacketInfo: snet.SCIONPacketInfo{ + replyPacket := &snet.Packet{ + PacketInfo: snet.PacketInfo{ Destination: request.Packet.Source, Source: request.Source, Path: path, diff --git a/go/lib/svc/svc_test.go b/go/lib/svc/svc_test.go index 74683e239d..aec5982744 100644 --- a/go/lib/svc/svc_test.go +++ b/go/lib/svc/svc_test.go @@ -69,11 +69,11 @@ func TestSVCResolutionServer(t *testing.T) { SoMsg("port", port, ShouldEqual, 1337) SoMsg("err", err, ShouldBeNil) - var pkt snet.SCIONPacket + var pkt snet.Packet var ov net.UDPAddr Convey("If handler fails, caller sees error", func() { mockPacketConn.EXPECT().ReadFrom(gomock.Any(), gomock.Any()).DoAndReturn( - func(pkt *snet.SCIONPacket, ov *net.UDPAddr) error { + func(pkt *snet.Packet, ov *net.UDPAddr) error { pkt.Destination = snet.SCIONAddress{ Host: addr.SvcPS, } @@ -88,7 +88,7 @@ func TestSVCResolutionServer(t *testing.T) { }) Convey("If handler returns forward, caller sees data", func() { mockPacketConn.EXPECT().ReadFrom(gomock.Any(), gomock.Any()).DoAndReturn( - func(pkt *snet.SCIONPacket, ov *net.UDPAddr) error { + func(pkt *snet.Packet, ov *net.UDPAddr) error { pkt.Destination = snet.SCIONAddress{ Host: addr.SvcPS, } @@ -102,7 +102,7 @@ func TestSVCResolutionServer(t *testing.T) { }) Convey("If handler succeeds", func() { mockPacketConn.EXPECT().ReadFrom(gomock.Any(), gomock.Any()).DoAndReturn( - func(pkt *snet.SCIONPacket, ov *net.UDPAddr) error { + func(pkt *snet.Packet, ov *net.UDPAddr) error { pkt.Destination = snet.SCIONAddress{ Host: addr.SvcPS, } @@ -112,7 +112,7 @@ func TestSVCResolutionServer(t *testing.T) { mockReqHandler.EXPECT().Handle(gomock.Any()).Return(svc.Handled, nil).AnyTimes() Convey("return from conn with no error next internal read yields data", func() { mockPacketConn.EXPECT().ReadFrom(gomock.Any(), gomock.Any()).DoAndReturn( - func(pkt *snet.SCIONPacket, ov *net.UDPAddr) error { + func(pkt *snet.Packet, ov *net.UDPAddr) error { pkt.Destination = snet.SCIONAddress{ Host: addr.HostIPv4(net.IP{192, 168, 0, 1}), } @@ -124,7 +124,7 @@ func TestSVCResolutionServer(t *testing.T) { }) Convey("return from socket with error if next internal read fails", func() { mockPacketConn.EXPECT().ReadFrom(gomock.Any(), gomock.Any()).DoAndReturn( - func(pkt *snet.SCIONPacket, ov *net.UDPAddr) error { + func(pkt *snet.Packet, ov *net.UDPAddr) error { return serrors.New("forced exit") }, ) @@ -134,7 +134,7 @@ func TestSVCResolutionServer(t *testing.T) { }) Convey("Multicast SVC packets get delivered to caller", func() { mockPacketConn.EXPECT().ReadFrom(gomock.Any(), gomock.Any()).DoAndReturn( - func(pkt *snet.SCIONPacket, ov *net.UDPAddr) error { + func(pkt *snet.Packet, ov *net.UDPAddr) error { pkt.Destination = snet.SCIONAddress{ Host: addr.SvcBS.Multicast(), } @@ -155,14 +155,14 @@ func TestDefaultHandler(t *testing.T) { Description string ReplySource snet.SCIONAddress ReplyPayload []byte - InputPacket *snet.SCIONPacket - ExpectedPacket *snet.SCIONPacket + InputPacket *snet.Packet + ExpectedPacket *snet.Packet ExpectedError bool }{ { Description: "path cannot be reversed", - InputPacket: &snet.SCIONPacket{ - SCIONPacketInfo: snet.SCIONPacketInfo{ + InputPacket: &snet.Packet{ + PacketInfo: snet.PacketInfo{ Path: spath.New(common.RawBytes{0x00, 0x01, 0x02, 0x03}), }, }, @@ -170,11 +170,11 @@ func TestDefaultHandler(t *testing.T) { }, { Description: "nil l4 header, success", - InputPacket: &snet.SCIONPacket{ - SCIONPacketInfo: snet.SCIONPacketInfo{}, + InputPacket: &snet.Packet{ + PacketInfo: snet.PacketInfo{}, }, - ExpectedPacket: &snet.SCIONPacket{ - SCIONPacketInfo: snet.SCIONPacketInfo{ + ExpectedPacket: &snet.Packet{ + PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{}, }, }, @@ -182,13 +182,13 @@ func TestDefaultHandler(t *testing.T) { }, { Description: "L4 header with ports", - InputPacket: &snet.SCIONPacket{ - SCIONPacketInfo: snet.SCIONPacketInfo{ + InputPacket: &snet.Packet{ + PacketInfo: snet.PacketInfo{ L4Header: &l4.UDP{SrcPort: 42, DstPort: 73}, }, }, - ExpectedPacket: &snet.SCIONPacket{ - SCIONPacketInfo: snet.SCIONPacketInfo{ + ExpectedPacket: &snet.Packet{ + PacketInfo: snet.PacketInfo{ L4Header: &l4.UDP{SrcPort: 73, DstPort: 42}, }, }, @@ -196,9 +196,9 @@ func TestDefaultHandler(t *testing.T) { { Description: "Non-nil payload", ReplyPayload: []byte{1, 2, 3, 4}, - InputPacket: &snet.SCIONPacket{}, - ExpectedPacket: &snet.SCIONPacket{ - SCIONPacketInfo: snet.SCIONPacketInfo{ + InputPacket: &snet.Packet{}, + ExpectedPacket: &snet.Packet{ + PacketInfo: snet.PacketInfo{ Payload: common.RawBytes{1, 2, 3, 4}, }, }, @@ -206,9 +206,9 @@ func TestDefaultHandler(t *testing.T) { { Description: "Source address override", ReplySource: snet.SCIONAddress{Host: addr.HostIPv4(net.IP{192, 168, 0, 1})}, - InputPacket: &snet.SCIONPacket{}, - ExpectedPacket: &snet.SCIONPacket{ - SCIONPacketInfo: snet.SCIONPacketInfo{ + InputPacket: &snet.Packet{}, + ExpectedPacket: &snet.Packet{ + PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{Host: addr.HostIPv4(net.IP{192, 168, 0, 1})}, }, }, @@ -245,7 +245,7 @@ func TestDefaultHandler(t *testing.T) { defer ctrl.Finish() conn := mock_snet.NewMockPacketConn(ctrl) - packet := &snet.SCIONPacket{} + packet := &snet.Packet{} ov := &net.UDPAddr{IP: net.IP{192, 168, 0, 1}, Port: 0x29a} conn.EXPECT().WriteTo(packet, ov).Times(1) sender := &svc.BaseHandler{} From d15c65bcdede84089d84e8c81bef24a4fe75d6c1 Mon Sep 17 00:00:00 2001 From: Matthias Frei Date: Thu, 19 Mar 2020 14:37:40 +0100 Subject: [PATCH 3/4] Remove snet.Conn interface, rename SCIONConn to Conn --- go/border/rctrl/ctrl.go | 2 +- go/integration/cert_req/main.go | 2 +- go/lib/pktdisp/disp.go | 2 +- go/lib/sciond/pathprobe/paths.go | 4 ++-- go/lib/sigdisp/disp.go | 2 +- go/lib/snet/conn.go | 15 +++++++-------- go/lib/snet/interface.go | 23 ++--------------------- go/lib/snet/mock_snet/snet.go | 8 ++++---- go/lib/snet/snet.go | 9 ++++----- go/lib/snet/squic/squic.go | 2 +- go/sig/egress/iface/interface.go | 4 ++-- go/sig/egress/iface/mock_iface/iface.go | 4 ++-- go/sig/egress/session/session.go | 4 ++-- go/sig/internal/ingress/dispatcher.go | 4 ++-- go/sig/internal/sigcmn/common.go | 2 +- 15 files changed, 33 insertions(+), 54 deletions(-) diff --git a/go/border/rctrl/ctrl.go b/go/border/rctrl/ctrl.go index 53ad7b3dc2..0923bb205b 100644 --- a/go/border/rctrl/ctrl.go +++ b/go/border/rctrl/ctrl.go @@ -39,7 +39,7 @@ const ( ) var ( - snetConn snet.Conn + snetConn *snet.Conn ia addr.IA logger log.Logger ) diff --git a/go/integration/cert_req/main.go b/go/integration/cert_req/main.go index e0809080b9..709692ad72 100644 --- a/go/integration/cert_req/main.go +++ b/go/integration/cert_req/main.go @@ -66,7 +66,7 @@ func addFlags() { } type client struct { - conn snet.Conn + conn *snet.Conn msgr infra.Messenger } diff --git a/go/lib/pktdisp/disp.go b/go/lib/pktdisp/disp.go index f25e61a657..d403a5e385 100644 --- a/go/lib/pktdisp/disp.go +++ b/go/lib/pktdisp/disp.go @@ -35,7 +35,7 @@ type DispatchFunc func(*DispPkt) // PktDispatcher listens on c, and calls f for every packet read. // N.B. the DispPkt passed to f is reused, so applications should make a copy if // this is a problem. -func PktDispatcher(c snet.Conn, f DispatchFunc, pktDispStop chan struct{}) { +func PktDispatcher(c *snet.Conn, f DispatchFunc, pktDispStop chan struct{}) { fatal.Check() var err error var n int diff --git a/go/lib/sciond/pathprobe/paths.go b/go/lib/sciond/pathprobe/paths.go index b85d1b07f8..3569b76fca 100644 --- a/go/lib/sciond/pathprobe/paths.go +++ b/go/lib/sciond/pathprobe/paths.go @@ -142,7 +142,7 @@ func (p Prober) GetStatuses(ctx context.Context, return scmpH.statuses, nil } -func (p Prober) send(scionConn snet.Conn, path snet.Path) error { +func (p Prober) send(scionConn *snet.Conn, path snet.Path) error { addr := &snet.SVCAddr{ IA: p.DstIA, Path: path.Path(), @@ -157,7 +157,7 @@ func (p Prober) send(scionConn snet.Conn, path snet.Path) error { return nil } -func (p Prober) receive(scionConn snet.Conn) error { +func (p Prober) receive(scionConn *snet.Conn) error { b := make([]byte, 1500, 1500) _, _, err := scionConn.ReadFrom(b) if err == nil { diff --git a/go/lib/sigdisp/disp.go b/go/lib/sigdisp/disp.go index a6a82281e8..855d8e6456 100644 --- a/go/lib/sigdisp/disp.go +++ b/go/lib/sigdisp/disp.go @@ -28,7 +28,7 @@ import ( "github.com/scionproto/scion/go/lib/snet" ) -func Init(conn snet.Conn, useid bool) { +func Init(conn *snet.Conn, useid bool) { useID = useid go func() { defer log.HandlePanic() diff --git a/go/lib/snet/conn.go b/go/lib/snet/conn.go index 151106ff19..f16fd88b32 100644 --- a/go/lib/snet/conn.go +++ b/go/lib/snet/conn.go @@ -52,19 +52,18 @@ func (e *OpError) Error() string { return e.scmp.String() } -var _ net.Conn = (*SCIONConn)(nil) -var _ net.PacketConn = (*SCIONConn)(nil) -var _ Conn = (*SCIONConn)(nil) +var _ net.Conn = (*Conn)(nil) +var _ net.PacketConn = (*Conn)(nil) -type SCIONConn struct { +type Conn struct { conn PacketConn scionConnBase scionConnWriter scionConnReader } -func newSCIONConn(base *scionConnBase, querier PathQuerier, conn PacketConn) *SCIONConn { - c := &SCIONConn{ +func newConn(base *scionConnBase, querier PathQuerier, conn PacketConn) *Conn { + c := &Conn{ conn: conn, scionConnBase: *base, } @@ -73,7 +72,7 @@ func newSCIONConn(base *scionConnBase, querier PathQuerier, conn PacketConn) *SC return c } -func (c *SCIONConn) SetDeadline(t time.Time) error { +func (c *Conn) SetDeadline(t time.Time) error { if err := c.scionConnReader.SetReadDeadline(t); err != nil { return err } @@ -83,6 +82,6 @@ func (c *SCIONConn) SetDeadline(t time.Time) error { return nil } -func (c *SCIONConn) Close() error { +func (c *Conn) Close() error { return c.conn.Close() } diff --git a/go/lib/snet/interface.go b/go/lib/snet/interface.go index caeb7d19d3..7b9e77fc47 100644 --- a/go/lib/snet/interface.go +++ b/go/lib/snet/interface.go @@ -18,31 +18,12 @@ package snet import ( "context" "net" - "time" "github.com/scionproto/scion/go/lib/addr" ) type Network interface { - Listen(ctx context.Context, network string, listen *net.UDPAddr, svc addr.HostSVC) (Conn, error) + Listen(ctx context.Context, network string, listen *net.UDPAddr, svc addr.HostSVC) (*Conn, error) Dial(ctx context.Context, network string, listen *net.UDPAddr, remote *UDPAddr, - svc addr.HostSVC) (Conn, error) -} - -// Conn represents a SCION connection. -type Conn interface { - Read(b []byte) (int, error) - ReadFrom(b []byte) (int, net.Addr, error) - Write(b []byte) (int, error) - WriteTo(b []byte, address net.Addr) (int, error) - Close() error - LocalAddr() net.Addr - SVC() addr.HostSVC - // RemoteAddr returns the remote network address. - RemoteAddr() net.Addr - // SetDeadline sets read and write deadlines. Implements the net.Conn - // SetDeadline method. - SetDeadline(deadline time.Time) error - SetReadDeadline(deadline time.Time) error - SetWriteDeadline(deadline time.Time) error + svc addr.HostSVC) (*Conn, error) } diff --git a/go/lib/snet/mock_snet/snet.go b/go/lib/snet/mock_snet/snet.go index a076844f13..380ffb7f62 100644 --- a/go/lib/snet/mock_snet/snet.go +++ b/go/lib/snet/mock_snet/snet.go @@ -260,10 +260,10 @@ func (m *MockNetwork) EXPECT() *MockNetworkMockRecorder { } // Dial mocks base method -func (m *MockNetwork) Dial(arg0 context.Context, arg1 string, arg2 *net.UDPAddr, arg3 *snet.UDPAddr, arg4 addr.HostSVC) (snet.Conn, error) { +func (m *MockNetwork) Dial(arg0 context.Context, arg1 string, arg2 *net.UDPAddr, arg3 *snet.UDPAddr, arg4 addr.HostSVC) (*snet.Conn, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Dial", arg0, arg1, arg2, arg3, arg4) - ret0, _ := ret[0].(snet.Conn) + ret0, _ := ret[0].(*snet.Conn) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -275,10 +275,10 @@ func (mr *MockNetworkMockRecorder) Dial(arg0, arg1, arg2, arg3, arg4 interface{} } // Listen mocks base method -func (m *MockNetwork) Listen(arg0 context.Context, arg1 string, arg2 *net.UDPAddr, arg3 addr.HostSVC) (snet.Conn, error) { +func (m *MockNetwork) Listen(arg0 context.Context, arg1 string, arg2 *net.UDPAddr, arg3 addr.HostSVC) (*snet.Conn, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Listen", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].(snet.Conn) + ret0, _ := ret[0].(*snet.Conn) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/go/lib/snet/snet.go b/go/lib/snet/snet.go index 248f0e6b9b..b6d76ea4e8 100644 --- a/go/lib/snet/snet.go +++ b/go/lib/snet/snet.go @@ -102,7 +102,7 @@ func NewCustomNetworkWithPR(ia addr.IA, pktDispatcher PacketDispatcherService) * // The context is used for connection setup, it doesn't affect the returned // connection. func (n *SCIONNetwork) Dial(ctx context.Context, network string, listen *net.UDPAddr, - remote *UDPAddr, svc addr.HostSVC) (Conn, error) { + remote *UDPAddr, svc addr.HostSVC) (*Conn, error) { metrics.M.Dials().Inc() if remote == nil { @@ -112,8 +112,7 @@ func (n *SCIONNetwork) Dial(ctx context.Context, network string, listen *net.UDP if err != nil { return nil, err } - snetConn := conn.(*SCIONConn) - snetConn.remote = remote.Copy() + conn.remote = remote.Copy() return conn, nil } @@ -125,7 +124,7 @@ func (n *SCIONNetwork) Dial(ctx context.Context, network string, listen *net.UDP // The context is used for connection setup, it doesn't affect the returned // connection. func (n *SCIONNetwork) Listen(ctx context.Context, network string, listen *net.UDPAddr, - svc addr.HostSVC) (Conn, error) { + svc addr.HostSVC) (*Conn, error) { metrics.M.Listens().Inc() @@ -164,5 +163,5 @@ func (n *SCIONNetwork) Listen(ctx context.Context, network string, listen *net.U conn.listen.Port = int(port) } log.Debug("Registered with dispatcher", "addr", &UDPAddr{IA: n.localIA, Host: conn.listen}) - return newSCIONConn(conn, n.querier, packetConn), nil + return newConn(conn, n.querier, packetConn), nil } diff --git a/go/lib/snet/squic/squic.go b/go/lib/snet/squic/squic.go index 933900a616..9bd5b9bf91 100644 --- a/go/lib/snet/squic/squic.go +++ b/go/lib/snet/squic/squic.go @@ -81,7 +81,7 @@ func Listen(network *snet.SCIONNetwork, listen *net.UDPAddr, } func sListen(network *snet.SCIONNetwork, listen *net.UDPAddr, - svc addr.HostSVC) (snet.Conn, error) { + svc addr.HostSVC) (*snet.Conn, error) { if network == nil { return nil, serrors.New("squic: SCION network must not be nil") diff --git a/go/sig/egress/iface/interface.go b/go/sig/egress/iface/interface.go index 680dccea5e..123f2e19ac 100644 --- a/go/sig/egress/iface/interface.go +++ b/go/sig/egress/iface/interface.go @@ -54,9 +54,9 @@ type Session interface { IA() addr.IA // ID returns the session's ID. ID() sig_mgmt.SessionType - // Conn returns the session's outbound snet Conn. + // Conn returns the session's outbound *snet.Conn. // The returned value must be the same for the entire lifetime of the object. - Conn() snet.Conn + Conn() *snet.Conn // Ring returns the session's ring buffer. Ring() *ringbuf.Ring // Remote returns the session's currently chosen SIG and path. diff --git a/go/sig/egress/iface/mock_iface/iface.go b/go/sig/egress/iface/mock_iface/iface.go index 1a368760ae..2b54d75392 100644 --- a/go/sig/egress/iface/mock_iface/iface.go +++ b/go/sig/egress/iface/mock_iface/iface.go @@ -65,10 +65,10 @@ func (mr *MockSessionMockRecorder) Cleanup() *gomock.Call { } // Conn mocks base method -func (m *MockSession) Conn() snet.Conn { +func (m *MockSession) Conn() *snet.Conn { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Conn") - ret0, _ := ret[0].(snet.Conn) + ret0, _ := ret[0].(*snet.Conn) return ret0 } diff --git a/go/sig/egress/session/session.go b/go/sig/egress/session/session.go index 342c6ab697..8482dd95ae 100644 --- a/go/sig/egress/session/session.go +++ b/go/sig/egress/session/session.go @@ -54,7 +54,7 @@ type Session struct { // FIXME: Use AtomicBool instead. healthy atomic.Value ring *ringbuf.Ring - conn snet.Conn + conn *snet.Conn sessMonStop chan struct{} sessMonStopped chan struct{} pktDispStop chan struct{} @@ -136,7 +136,7 @@ func (s *Session) Ring() *ringbuf.Ring { return s.ring } -func (s *Session) Conn() snet.Conn { +func (s *Session) Conn() *snet.Conn { return s.conn } diff --git a/go/sig/internal/ingress/dispatcher.go b/go/sig/internal/ingress/dispatcher.go index 8c57bbf29f..9e5e7ee8ce 100644 --- a/go/sig/internal/ingress/dispatcher.go +++ b/go/sig/internal/ingress/dispatcher.go @@ -42,12 +42,12 @@ const ( // appropriate Worker, starting a new one if none currently exists. type Dispatcher struct { workers map[string]*Worker - extConn snet.Conn + extConn *snet.Conn tunIO io.ReadWriteCloser framesRecvCounters map[metrics.CtrPairKey]metrics.CtrPair } -func NewDispatcher(tio io.ReadWriteCloser, conn snet.Conn) *Dispatcher { +func NewDispatcher(tio io.ReadWriteCloser, conn *snet.Conn) *Dispatcher { return &Dispatcher{ tunIO: tio, extConn: conn, diff --git a/go/sig/internal/sigcmn/common.go b/go/sig/internal/sigcmn/common.go index 512a393dc2..4e9b08720d 100644 --- a/go/sig/internal/sigcmn/common.go +++ b/go/sig/internal/sigcmn/common.go @@ -54,7 +54,7 @@ var ( CtrlPort int DataAddr net.IP DataPort int - CtrlConn snet.Conn + CtrlConn *snet.Conn ) func Init(cfg sigconfig.SigConf, sdCfg env.SCIONDClient) error { From d65c7d1d42752fecf9279c70640bd8319f4c7367 Mon Sep 17 00:00:00 2001 From: Matthias Frei Date: Tue, 24 Mar 2020 07:35:33 +0100 Subject: [PATCH 4/4] Fix lint --- go/lib/snet/interface.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/go/lib/snet/interface.go b/go/lib/snet/interface.go index 7b9e77fc47..77b7a70c30 100644 --- a/go/lib/snet/interface.go +++ b/go/lib/snet/interface.go @@ -23,7 +23,8 @@ import ( ) type Network interface { - Listen(ctx context.Context, network string, listen *net.UDPAddr, svc addr.HostSVC) (*Conn, error) + Listen(ctx context.Context, network string, listen *net.UDPAddr, + svc addr.HostSVC) (*Conn, error) Dial(ctx context.Context, network string, listen *net.UDPAddr, remote *UDPAddr, svc addr.HostSVC) (*Conn, error) }