--------------------------------------------------------------------------- Agent profile matching --------------------------------------------------------------------------- MatchAgentProfile returns the AgentProfile matching the given User-Agent string. Falls back to defaultProfile if no known age
(userAgent string)
| 99 | // MatchAgentProfile returns the AgentProfile matching the given User-Agent string. |
| 100 | // Falls back to defaultProfile if no known agent is matched. |
| 101 | func MatchAgentProfile(userAgent string) AgentProfile { |
| 102 | lower := strings.ToLower(userAgent) |
| 103 | for _, p := range knownAgentProfiles { |
| 104 | if strings.Contains(lower, p.UserAgentPattern) { |
| 105 | return p |
| 106 | } |
| 107 | } |
| 108 | return defaultProfile |
| 109 | } |
| 110 | |
| 111 | // --------------------------------------------------------------------------- |
| 112 | // Transfer planning |
no outgoing calls