MCPcopy
hub / github.com/CodisLabs/codis / NewToken

Function NewToken

pkg/utils/rpc/crypto.go:15–33  ·  view source on GitHub ↗
(segs ...string)

Source from the content-addressed store, hash-verified

13)
14
15func NewToken(segs ...string) string {
16 var list []string
17 ifs, _ := net.Interfaces()
18 for _, i := range ifs {
19 addr := i.HardwareAddr.String()
20 if addr != "" {
21 list = append(list, addr)
22 }
23 }
24 sort.Strings(list)
25
26 t := &bytes.Buffer{}
27 fmt.Fprintf(t, "Codis-Token@%v", list)
28 for _, s := range segs {
29 fmt.Fprintf(t, "-{%s}", s)
30 }
31 b := md5.Sum(t.Bytes())
32 return fmt.Sprintf("%x", b)
33}
34
35func NewXAuth(segs ...string) string {
36 t := &bytes.Buffer{}

Callers

nothing calls this directly

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected