6ff8d018525b73c8836fa687bf16f45ccc1a11f1 galt Wed Jun 21 23:33:34 2023 -0700 Adding a utility for using our existing geoIp infrastructure to lookup a 2-letter country code from an IP address (IPv4 or IPv6). Gives an error if the IP address is malformed, gives an error if hgcentral.geoIpCountry6 table does not exist, then uses it to lookup the country. If it is not found in our Maxmind table, then it returns "not found". Hopefully Hiram and others can use this. diff --git src/hg/geoIpToCountry/makefile src/hg/geoIpToCountry/makefile new file mode 100644 index 0000000..bac19e9 --- /dev/null +++ src/hg/geoIpToCountry/makefile @@ -0,0 +1,21 @@ +kentSrc = ../.. +include ${kentSrc}/inc/common.mk + +HG_INC+=-I${kentSrc}/hg/inc -I${kentSrc}/inc + +L += $(MYSQLLIBS) -lm ${SOCKETLIB} +MYLIBDIR = ${kentSrc}/lib/${MACHTYPE} +MYLIBS = $(MYLIBDIR)/jkhgap.a $(MYLIBDIR)/jkweb.a + +A = geoIpToCountry + +O = $(A).o + +$(A): ${O} ${MYLIBS} + @${MKDIR} "${DESTDIR}${BINDIR}" + ${CC} ${COPT} ${CFLAGS} -o ${DESTDIR}${BINDIR}/${A}${EXE} $O ${MYLIBS} ${L} + ${STRIP} ${DESTDIR}${BINDIR}/${A}${EXE} + +clean:: + rm -f ${O} +