Improve DN42 related whois handling

This commit is contained in:
Lan Tian 2020-04-10 12:33:56 +08:00
parent cc121c8b49
commit 43f087e51b
No known key found for this signature in database
GPG Key ID: 27F31700E751EC22
6 changed files with 15 additions and 5 deletions

View File

@ -14,7 +14,7 @@ func dn42WhoisFilter(whois string) string {
filteredPrefix := []string{
"descr:", "remarks:", "ds-rdata:", "auth:", "country:",
"nserver:", "status:", "pgp-fingerprint:", "mp-import:", "mp-export:",
"members:", "key:", "inetnum:", "inet6num:", "%",
"members:", "key:", "inetnum:", "inet6num:",
}
for _, s := range strings.Split(whois, "\n") {
if len(s) == 0 {

View File

@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"net/http"
"strconv"
"strings"
)
@ -113,6 +114,15 @@ func webHandlerTelegramBot(w http.ResponseWriter, r *http.Request) {
})
} else if telegramIsCommand(request.Message.Text, "whois") {
if setting.netSpecificMode == "dn42" {
targetNumber, err := strconv.Atoi(target)
if err == nil {
if targetNumber < 10000 {
targetNumber += 4242420000
target = strconv.Itoa(targetNumber)
}
}
}
tempResult := whois(target)
if setting.netSpecificMode == "dn42" {
commandResult = dn42WhoisFilter(tempResult)

View File

@ -4,7 +4,7 @@ LABEL Lan Tian "lantian@lantian.pub"
ENV GOOS=linux GOARCH=amd64
WORKDIR /root
COPY . .
RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang traceroute locales \
RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang traceroute locales busybox \
&& cd /root && go build -o /proxy \
&& cd / && rm -rf /root/* \
&& printf "en_US.UTF-8 UTF-8\nzh_CN.UTF-8 UTF-8\n" > /etc/locale.gen \

View File

@ -4,7 +4,7 @@ LABEL Lan Tian "lantian@lantian.pub"
ENV GOOS=linux GOARCH=arm
WORKDIR /root
COPY . .
RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang traceroute locales \
RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang traceroute locales busybox \
&& cd /root && go build -o /proxy \
&& cd / && rm -rf /root/* \
&& printf "en_US.UTF-8 UTF-8\nzh_CN.UTF-8 UTF-8\n" > /etc/locale.gen \

View File

@ -4,7 +4,7 @@ LABEL Lan Tian "lantian@lantian.pub"
ENV GOOS=linux GOARCH=arm64
WORKDIR /root
COPY . .
RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang traceroute locales \
RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang traceroute locales busybox \
&& cd /root && go build -o /proxy \
&& cd / && rm -rf /root/* \
&& printf "en_US.UTF-8 UTF-8\nzh_CN.UTF-8 UTF-8\n" > /etc/locale.gen \

View File

@ -4,7 +4,7 @@ LABEL Lan Tian "lantian@lantian.pub"
ENV GOOS=linux GOARCH=386
WORKDIR /root
COPY . .
RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang traceroute locales \
RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang traceroute locales busybox \
&& cd /root && go build -o /proxy \
&& cd / && rm -rf /root/* \
&& printf "en_US.UTF-8 UTF-8\nzh_CN.UTF-8 UTF-8\n" > /etc/locale.gen \