From 8d04fcaf4b28153227ddc2b6df995468ffeb356a Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 2 Oct 2015 13:45:12 +0200 Subject: Make lint happy, minor formating --- spdu/spdu.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'spdu/spdu.go') diff --git a/spdu/spdu.go b/spdu/spdu.go index 7d1992b..bf4c2da 100644 --- a/spdu/spdu.go +++ b/spdu/spdu.go @@ -1,4 +1,4 @@ -// SPDU (Session Protocol Data Unit) +// Package spdu (Session Protocol Data Unit) package spdu import ( @@ -14,8 +14,10 @@ import ( const maxLen = 240 // max PDU size +// Conn spdu type Conn struct{ net.Conn } +// Write spdu func (c Conn) Write(p []byte) (n int, err error) { size := uint16(len(p)) if size > maxLen { @@ -27,6 +29,7 @@ func (c Conn) Write(p []byte) (n int, err error) { return c.Conn.Write(p) } +// Read spdu func (c Conn) Read(p []byte) (n int, err error) { var size uint16 if err := binary.Read(c.Conn, binary.BigEndian, &size); err != nil { @@ -35,12 +38,14 @@ func (c Conn) Read(p []byte) (n int, err error) { return c.Conn.Read(p[:size]) } +// ReadAll spdu func ReadAll(r io.Reader) ([]byte, error) { p := make([]byte, maxLen) n, err := r.Read(p) return p[:n], err } +// Dial spdu func Dial(service string) (Conn, error) { conn, err := net.Dial("tcp", service) if err != nil { -- cgit v1.2.3