MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / buildUserinfo

Function buildUserinfo

internal/serverapi/sub.go:117–129  ·  view source on GitHub ↗

buildUserinfo 生成 Subscription-Userinfo header 值。

(u users.User)

Source from the content-addressed store, hash-verified

115
116// buildUserinfo 生成 Subscription-Userinfo header 值。
117func buildUserinfo(u users.User) string {
118 parts := []string{
119 fmt.Sprintf("upload=%d", u.UploadBytes),
120 fmt.Sprintf("download=%d", u.DownloadBytes),
121 }
122 if u.TrafficLimit > 0 {
123 parts = append(parts, fmt.Sprintf("total=%d", u.TrafficLimit))
124 }
125 if u.ExpireAt != nil && !u.ExpireAt.IsZero() {
126 parts = append(parts, fmt.Sprintf("expire=%d", u.ExpireAt.Unix()))
127 }
128 return strings.Join(parts, "; ")
129}

Callers 1

handleSubMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected