diff --git a/storage/data.go b/storage/data.go index 8ff1851..2402a49 100644 --- a/storage/data.go +++ b/storage/data.go @@ -5,12 +5,12 @@ package storage type Peer struct { - Id string - UserId uint64 - TorrentId uint64 + ID string + UserID uint64 + TorrentID uint64 Port uint - Ip string + IP string Addr []byte Uploaded uint64 @@ -18,13 +18,13 @@ type Peer struct { Left uint64 Seeding bool - StartTime int64 // Unix Timestamp - LastAnnounce int64 + StartTimeUnix int64 + LastAnnounce int64 } type Torrent struct { - Id uint64 - InfoHash string + ID uint64 + Infohash string UpMultiplier float64 DownMultiplier float64 @@ -37,7 +37,7 @@ type Torrent struct { } type User struct { - Id uint64 + ID uint64 Passkey string UpMultiplier float64 DownMultiplier float64 diff --git a/storage/redis/redis.go b/storage/redis/redis.go index 519369c..3bbef47 100644 --- a/storage/redis/redis.go +++ b/storage/redis/redis.go @@ -85,12 +85,12 @@ func (c *Conn) FindUser(passkey string) (*storage.User, bool, error) { reply, err := redis.Values(conn.Do("HGETALL", key)) if err != nil { - return nil, false, err + return nil, true, err } user := &storage.User{} err = redis.ScanStruct(reply, user) if err != nil { - return nil, false, err + return nil, true, err } return user, true, nil } @@ -111,12 +111,12 @@ func (c *Conn) FindTorrent(infohash string) (*storage.Torrent, bool, error) { reply, err := redis.Values(conn.Do("HGETALL", key)) if err != nil { - return nil, false, err + return nil, true, err } torrent := &storage.Torrent{} err = redis.ScanStruct(reply, torrent) if err != nil { - return nil, false, err + return nil, true, err } return torrent, true, nil }