mirror of
https://github.com/go-i2p/goSam.git
synced 2025-07-13 14:18:25 -04:00
re-write some tests
This commit is contained in:
@ -39,7 +39,6 @@ type Reply struct {
|
||||
}
|
||||
|
||||
func parseReply(line string) (*Reply, error) {
|
||||
fmt.Println("PARSER PARTS", line)
|
||||
line = strings.TrimSpace(line)
|
||||
parts := strings.Split(line, " ")
|
||||
if len(parts) < 3 {
|
||||
@ -54,11 +53,16 @@ func parseReply(line string) (*Reply, error) {
|
||||
|
||||
for _, v := range parts[2:] {
|
||||
if strings.Contains(v, "FROM_PORT") {
|
||||
r.From = v
|
||||
if v != "FROM_PORT=0" {
|
||||
r.From = v
|
||||
}
|
||||
} else if strings.Contains(v, "TO_PORT") {
|
||||
r.To = v
|
||||
if v != "TO_PORT=0" {
|
||||
r.To = v
|
||||
}
|
||||
} else {
|
||||
kvPair := strings.SplitN(v, "=", 2)
|
||||
fmt.Printf("Reply, %s", parts)
|
||||
if kvPair != nil {
|
||||
if len(kvPair) != 2 {
|
||||
return nil, fmt.Errorf("Malformed key-value-pair.\n%s\n", kvPair)
|
||||
|
Reference in New Issue
Block a user