code: func (sp *serverPeer) HasUndesiredUserAgent(blacklistedAgents,
  	whitelistedAgents []string) bool {
  
  	agent := sp.UserAgent()
  
  	// First, if peer's user agent contains any blacklisted substring, we
  	// will ignore the connection request.
  	for _, blacklistedAgent := range blacklistedAgents {
  		if strings.Contains(agent, blacklistedAgent) {
  			srvrLog.Debugf("Ignoring peer %s, user agent "+
  				"contains blacklisted user agent: %s", sp,
  				agent)
  			return true
  		}
  	}
  
  	// If no whitelist is provided, we will accept all user agents.
  	if len(whitelistedAgents) == 0 {
  		return false
  	}
  
  	// Peer's user agent passed blacklist. Now check to see if it contains
  	// one of our whitelisted user agents, if so accept.
  	for _, whitelistedAgent := range whitelistedAgents {
  		if strings.Contains(agent, whitelistedAgent) {
  			return false
  		}
  	}
  
  	// Otherwise, the peer's user agent was not included in our whitelist.
  	// Ignore just in case it could stall the initial block download.
  	srvrLog.Debugf("Ignoring peer %s, user agent: %s not found in "+
  		"whitelist", sp, agent)
  
  	return true
  }
docs: // HasUndesiredUserAgent determines whether the server should continue to pursue
  // a connection with this peer based on its advertised user agent. It performs
  // the following steps:
  // 1) Reject the peer if it contains a blacklisted agent.
  // 2) If no whitelist is provided, accept all user agents.
  // 3) Accept the peer if it contains a whitelisted agent.
  // 4) Reject all other peers.