MCPcopy
hub / github.com/tinode/chat / platformFromUA

Function platformFromUA

server/utils.go:715–735  ·  view source on GitHub ↗

Detect platform from the UserAgent string.

(ua string)

Source from the content-addressed store, hash-verified

713
714// Detect platform from the UserAgent string.
715func platformFromUA(ua string) string {
716 ua = strings.ToLower(ua)
717 switch {
718 case strings.Contains(ua, "reactnative"):
719 switch {
720 case strings.Contains(ua, "iphone"),
721 strings.Contains(ua, "ipad"):
722 return "ios"
723 case strings.Contains(ua, "android"):
724 return "android"
725 }
726 return ""
727 case strings.Contains(ua, "tinodejs"):
728 return "web"
729 case strings.Contains(ua, "tindroid"):
730 return "android"
731 case strings.Contains(ua, "tinodios"):
732 return "ios"
733 }
734 return ""
735}
736
737func parseTLSConfig(tlsEnabled bool, jsconfig json.RawMessage) (*tls.Config, error) {
738 type tlsAutocertConfig struct {

Callers 1

helloMethod · 0.85

Calls 1

ContainsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…