MCPcopy Create free account
hub / github.com/ddnet/ddnet / InitDnsbl

Method InitDnsbl

src/engine/server/server.cpp:1228–1252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1226}
1227
1228void CServer::InitDnsbl(int ClientId)
1229{
1230 NETADDR Addr = *ClientAddr(ClientId);
1231
1232 //TODO: support ipv6
1233 if(Addr.type != NETTYPE_IPV4)
1234 return;
1235
1236 // build dnsbl host lookup
1237 char aBuf[256];
1238 if(Config()->m_SvDnsblKey[0] == '\0')
1239 {
1240 // without key
1241 str_format(aBuf, sizeof(aBuf), "%d.%d.%d.%d.%s", Addr.ip[3], Addr.ip[2], Addr.ip[1], Addr.ip[0], Config()->m_SvDnsblHost);
1242 }
1243 else
1244 {
1245 // with key
1246 str_format(aBuf, sizeof(aBuf), "%s.%d.%d.%d.%d.%s", Config()->m_SvDnsblKey, Addr.ip[3], Addr.ip[2], Addr.ip[1], Addr.ip[0], Config()->m_SvDnsblHost);
1247 }
1248
1249 m_aClients[ClientId].m_pDnsblLookup = std::make_shared<CHostLookup>(aBuf, NETTYPE_IPV4);
1250 Engine()->AddJob(m_aClients[ClientId].m_pDnsblLookup);
1251 m_aClients[ClientId].m_DnsblState = EDnsblState::PENDING;
1252}
1253
1254#ifdef CONF_FAMILY_UNIX
1255void CServer::SendConnLoggingCommand(CONN_LOGGING_CMD Cmd, const NETADDR *pAddr)

Callers

nothing calls this directly

Calls 4

str_formatFunction · 0.85
EngineFunction · 0.85
AddJobMethod · 0.80
ConfigFunction · 0.50

Tested by

no test coverage detected