Merge pull request #7 from hulb/fix

fix type assert and Dockerfile
This commit is contained in:
zu1k
2020-08-15 17:08:33 +08:00
committed by GitHub
3 changed files with 28 additions and 8 deletions

View File

@@ -10,5 +10,8 @@ RUN go mod download && \
FROM alpine:latest
RUN apk add --no-cache ca-certificates
COPY --from=builder /proxypool /
ENTRYPOINT ["/proxypool"]
WORKDIR /proxypool-src
COPY ./assets /proxypool-src/assets
COPY ./source.yaml /proxypool-src
COPY --from=builder /proxypool /proxypool-src/
ENTRYPOINT ["/proxypool-src/proxypool"]

View File

@@ -22,14 +22,22 @@ type TGChannelGetter struct {
func NewTGChannelGetter(options tool.Options) Getter {
num, found := options["num"]
if !found || num.(int) <= 0 {
num = 200
t := 200
switch num.(type) {
case int:
t = num.(int)
case float64:
t = int(num.(float64))
}
if !found || t <= 0 {
t = 200
}
url, found := options["channel"]
if found {
return &TGChannelGetter{
c: colly.NewCollector(),
NumNeeded: num.(int),
NumNeeded: t,
Url: "https://t.me/s/" + url.(string),
}
}

View File

@@ -22,14 +22,23 @@ type WebFanqiangdang struct {
func NewWebFanqiangdangGetter(options tool.Options) Getter {
num, found := options["num"]
if !found || num.(int) <= 0 {
num = 200
t := 200
switch num.(type) {
case int:
t = num.(int)
case float64:
t = int(num.(float64))
}
if !found || t <= 0 {
t = 200
}
url, found := options["url"]
if found {
return &WebFanqiangdang{
c: colly.NewCollector(),
NumNeeded: num.(int),
NumNeeded: t,
Url: url.(string),
}
}