From 8b09ca7502bb528452f5fda5acbd28dfa3d52a88 Mon Sep 17 00:00:00 2001 From: Haris Khan Date: Sat, 2 Nov 2024 21:57:11 -0400 Subject: [PATCH 1/3] more uniform naming --- stream.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/stream.go b/stream.go index 2625490..f5de64e 100644 --- a/stream.go +++ b/stream.go @@ -42,40 +42,40 @@ func (s *StreamSession) SetWriteDeadline(t time.Time) error { return s.conn.SetWriteDeadline(t) } -func (ss *StreamSession) From() string { - return ss.from +func (s *StreamSession) From() string { + return s.from } -func (ss *StreamSession) To() string { - return ss.to +func (s *StreamSession) To() string { + return s.to } -func (ss *StreamSession) SignatureType() string { - return ss.sigType +func (s *StreamSession) SignatureType() string { + return s.sigType } // Returns the local tunnel name of the I2P tunnel used for the stream session -func (ss *StreamSession) ID() string { - return ss.id +func (s *StreamSession) ID() string { + return s.id } -func (ss *StreamSession) Close() error { - log.WithField("id", ss.id).Debug("Closing StreamSession") - return ss.conn.Close() +func (s *StreamSession) Close() error { + log.WithField("id", s.id).Debug("Closing StreamSession") + return s.conn.Close() } // Returns the I2P destination (the address) of the stream session -func (ss *StreamSession) Addr() i2pkeys.I2PAddr { - return ss.keys.Addr() +func (s *StreamSession) Addr() i2pkeys.I2PAddr { + return s.keys.Addr() } -func (ss *StreamSession) LocalAddr() net.Addr { - return ss.keys.Addr() +func (s *StreamSession) LocalAddr() net.Addr { + return s.keys.Addr() } // Returns the keys associated with the stream session -func (ss *StreamSession) Keys() i2pkeys.I2PKeys { - return ss.keys +func (s *StreamSession) Keys() i2pkeys.I2PKeys { + return s.keys } // Creates a new StreamSession with the I2CP- and streaminglib options as From 67554060fb1fc5dd7154439c8301c0bbca5d1529 Mon Sep 17 00:00:00 2001 From: Haris Khan Date: Sat, 2 Nov 2024 22:20:52 -0400 Subject: [PATCH 2/3] minor typo fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 55da59d..f435c3f 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ export DEBUG_I2P=warn export DEBUG_I2P=error ``` -If I2P_DEBUG is set to an unrecognized variable, it will fall back to "debug". +If DEBUG_I2P is set to an unrecognized variable, it will fall back to "debug". ## License ## From 14d0b22a2887dad21fef5b3301d2f3ddb91d01cf Mon Sep 17 00:00:00 2001 From: Haris Khan Date: Sat, 2 Nov 2024 23:26:10 -0400 Subject: [PATCH 3/3] add Read() and Write() methods --- stream.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/stream.go b/stream.go index f5de64e..7ca9003 100644 --- a/stream.go +++ b/stream.go @@ -27,6 +27,16 @@ type StreamSession struct { to string } +// Read reads data from the stream. +func (s *StreamSession) Read(buf []byte) (int, error) { + return s.conn.Read(buf) +} + +// Write sends data over the stream. +func (s *StreamSession) Write(data []byte) (int, error) { + return s.conn.Write(data) +} + func (s *StreamSession) SetDeadline(t time.Time) error { log.WithField("deadline", t).Debug("Setting deadline for StreamSession") return s.conn.SetDeadline(t)