aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-10-02 13:45:12 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-10-02 13:45:12 +0200
commit8d04fcaf4b28153227ddc2b6df995468ffeb356a (patch)
tree9312ca531b94a939936cf6a18233b3cd5263fe6e
parenta35af432542e9797ee4946aa999616643ce49b71 (diff)
Make lint happy, minor formating
-rw-r--r--misc/codes.go4
-rw-r--r--spdu/spdu.go7
2 files changed, 8 insertions, 3 deletions
diff --git a/misc/codes.go b/misc/codes.go
index 6bc3e13..075fe1c 100644
--- a/misc/codes.go
+++ b/misc/codes.go
@@ -104,7 +104,7 @@ var phoneCodes = map[int]string{
var keyCodes = map[int]string{
0x00: `Not stored key`,
- 0x02: `ICD Group(GDN)`,
+ 0x02: `ICD Group (GDN)`,
0x03: `Single-CO`,
0x04: `Group-CO`,
0x05: `Loop-CO`,
@@ -132,7 +132,7 @@ var keyCodes = map[int]string{
0x60: `Voice Mail Transfer`,
0x61: `Two Way Record`,
0x62: `Two Way Transfer`,
- 0x63: `Live Call Screen(LCS)`,
+ 0x63: `Live Call Screen (LCS)`,
0x70: `Wake Up Alert`,
0x71: `Wake Up Set`,
0x72: `Check In`,
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 {