1 // Package version provides default versions, user-agents etc. for client identification.
12 DefaultExtendedHandshakeClientVersion string
13 // This should be updated when client behaviour changes in a way that other peers could care
15 DefaultBep20Prefix = "-GT0003-"
16 DefaultHttpUserAgent string
22 longNamespace = "anacrolix"
23 longPackageName = "torrent"
27 thisPkg := reflect.TypeOf(newtype).PkgPath()
30 mainVersion = "unknown"
31 torrentVersion = "unknown"
33 if buildInfo, ok := debug.ReadBuildInfo(); ok {
34 mainPath = buildInfo.Main.Path
35 mainVersion = buildInfo.Main.Version
37 // Note that if the main module is the same as this module, we get a version of "(devel)".
38 for _, dep := range append(buildInfo.Deps, &buildInfo.Main) {
39 if strings.HasPrefix(thisPkg, dep.Path) && len(dep.Path) >= len(thisModule) {
41 torrentVersion = dep.Version
45 DefaultExtendedHandshakeClientVersion = fmt.Sprintf(
53 DefaultUpnpId = fmt.Sprintf("%v %v", mainPath, mainVersion)
54 // Per https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent#library_and_net_tool_ua_strings
55 DefaultHttpUserAgent = fmt.Sprintf(