set unique gob name and update go mod

master v1.2.3
兔子 2 years ago
parent 48bbc5b776
commit a2ab64a372

@ -15,10 +15,6 @@ import (
"time"
)
func init() {
Register(TransferMsg{})
}
type ClientCommon struct {
alive atomic.Value
status Status

@ -80,3 +80,7 @@ func defaultMsgEn(key []byte, d []byte) []byte {
func defaultMsgDe(key []byte, d []byte) []byte {
return starcrypto.AesDecryptCFB(d, key)
}
func init() {
RegisterName("b612.me/notify.Transfer", TransferMsg{})
}

@ -4,6 +4,12 @@ go 1.16
require (
b612.me/starcrypto v0.0.2
b612.me/stario v0.0.5
b612.me/starnet v0.1.3
b612.me/stario v0.0.7
b612.me/starnet v0.1.6
)
require (
golang.org/x/crypto v0.0.0-20220313003712-b769efc7c000 // indirect
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
)

@ -1,9 +1,9 @@
b612.me/starcrypto v0.0.2 h1:aRf1HcqK8GqHYxLAhWfFC4W/EqQLEFNEmxsBu3wG30o=
b612.me/starcrypto v0.0.2/go.mod h1:hz0xRnfWNpYOlVrIPoGrQOWPibq4YiUZ7qN5tsQbzPo=
b612.me/stario v0.0.5 h1:Q1OGF+8eOoK49zMzkyh80GWaMuknhey6+PWJJL9ZuNo=
b612.me/stario v0.0.5/go.mod h1:or4ssWcxQSjMeu+hRKEgtp0X517b3zdlEOAms8Qscvw=
b612.me/starnet v0.1.3 h1:UjY6M96gdPdJtxnQGzCttqSwFw93sDZSHiIGtdOlFfk=
b612.me/starnet v0.1.3/go.mod h1:j/dd6BKwQK80O4gfbGYg2aYtPH76gSdgpuKboK/DwN4=
b612.me/stario v0.0.7 h1:QbQcsHCVLE6vRgVrPN4+9DGiSaC6IWdtm4ClL2tpMUg=
b612.me/stario v0.0.7/go.mod h1:or4ssWcxQSjMeu+hRKEgtp0X517b3zdlEOAms8Qscvw=
b612.me/starnet v0.1.6 h1:/QaaKpuXfvJm6ayvk85jaLaKBmO1zx+XSxfnlSB3xGw=
b612.me/starnet v0.1.6/go.mod h1:JjFLTMPsWsPei7AiXwBTt4QCoB9gux1XS7SHv/Ux+D4=
golang.org/x/crypto v0.0.0-20220313003712-b769efc7c000 h1:SL+8VVnkqyshUSz5iNnXtrBQzvFF2SkROm6t5RczFAE=
golang.org/x/crypto v0.0.0-20220313003712-b769efc7c000/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=

@ -9,11 +9,22 @@ func Register(data interface{}) {
gob.Register(data)
}
func RegisterName(name string, data interface{}) {
gob.RegisterName(name, data)
}
func RegisterAll(data []interface{}) {
for _, v := range data {
gob.Register(v)
}
}
func RegisterNames(data map[string]interface{}) {
for k, v := range data {
gob.RegisterName(k, v)
}
}
func encode(src interface{}) ([]byte, error) {
var buf bytes.Buffer
enc := gob.NewEncoder(&buf)

@ -15,10 +15,6 @@ import (
"time"
)
func init() {
Register(TransferMsg{})
}
type ServerCommon struct {
msgID uint64
alive atomic.Value

Loading…
Cancel
Save