]> git.lizzy.rs Git - go-anidb.git/commitdiff
udpapi: Register types with encoding/gob
authorDiogo Franco (Kovensky) <diogomfranco@gmail.com>
Sat, 13 Jul 2013 02:22:02 +0000 (23:22 -0300)
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>
Sat, 13 Jul 2013 02:22:31 +0000 (23:22 -0300)
udp/misc.go
udp/reply.go

index f106717d640904213841ec260d9009d9593a72e4..3cf2428d690483da588d847dcefe9e2945594ea4 100755 (executable)
@@ -1,10 +1,18 @@
 package udpapi
 
 import (
+       "encoding/gob"
        "strconv"
        "time"
 )
 
+func init() {
+       // implements APIReply
+       gob.RegisterName("udpapi.UptimeReply", UptimeReply{})
+       // implements APIReply
+       gob.RegisterName("udpapi.PingReply", PingReply{})
+}
+
 type UptimeReply struct {
        APIReply
        Uptime time.Duration
index 7b391f87499da7c7f5fde74071c2ef4df3848bf6..b517f213345eac0456a59969dcaa17fbbfcb9bea 100755 (executable)
@@ -5,8 +5,19 @@ import (
        "fmt"
        "strconv"
        "strings"
+
+       "encoding/gob"
 )
 
+func init() {
+       // implements error
+       gob.RegisterName("udpapi.APIError", APIError{})
+       // implements APIReply
+       gob.RegisterName("udpapi.errorWrapper", errorWrapper{})
+       // implements APIReply
+       gob.RegisterName("udpapi.genericReply", genericReply{})
+}
+
 type APIError struct {
        Code int
        Desc string