feat: update error request
This commit is contained in:
parent
93668341a3
commit
794595a2c9
14
go.mod
14
go.mod
@ -1,18 +1,6 @@
|
|||||||
module docker-image-sync
|
module yumc.pw/cloud/docker-image-sync
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/cweill/gotests v1.5.2 // indirect
|
|
||||||
github.com/go-redis/redis v6.14.2+incompatible
|
github.com/go-redis/redis v6.14.2+incompatible
|
||||||
github.com/golang/lint v0.0.0-20181026193005-c67002cb31c3 // indirect
|
|
||||||
github.com/lukehoban/go-find-references v0.0.0-20150918174914-42505ef666d1 // indirect
|
|
||||||
github.com/lukehoban/go-outline v0.0.0-20161011150102-e78556874252 // indirect
|
|
||||||
github.com/lukehoban/ident v0.0.0-20161021214352-ec6acfba39eb // indirect
|
|
||||||
github.com/newhook/go-symbols v0.0.0-20151212134530-b75dfefa0d23 // indirect
|
|
||||||
github.com/nsf/gocode v0.0.0-20180902125341-7b1d4e18cdc5 // indirect
|
|
||||||
github.com/onsi/gomega v1.4.2 // indirect
|
github.com/onsi/gomega v1.4.2 // indirect
|
||||||
github.com/rogpeppe/godef v1.0.0 // indirect
|
|
||||||
github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518 // indirect
|
|
||||||
github.com/tpng/gopkgs v0.0.0-20180428091733-81e90e22e204 // indirect
|
|
||||||
sourcegraph.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518 // indirect
|
|
||||||
yumc.pw/cloud/docker-image-sync v0.0.0-20181029103637-0be3e70228f3 // indirect
|
|
||||||
)
|
)
|
||||||
|
25
go.sum
25
go.sum
@ -1,36 +1,15 @@
|
|||||||
9fans.net/go v0.0.0-20150709035532-65b8cf069318/go.mod h1:diCsxrliIURU9xsYtjCp5AbpQKqdhKmf0ujWDUSkfoY=
|
|
||||||
github.com/cweill/gotests v1.5.2 h1:kKqmKmS2wCV3tuLnfpbiuN8OlkosQZTpCfiqmiuNAsA=
|
|
||||||
github.com/cweill/gotests v1.5.2/go.mod h1:XZYOJkGVkCRoymaIzmp9Wyi3rUgfA3oOnkuljYrjFV8=
|
|
||||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
github.com/go-redis/redis v6.14.2+incompatible h1:UE9pLhzmWf+xHNmZsoccjXosPicuiNaInPgym8nzfg0=
|
github.com/go-redis/redis v6.14.2+incompatible h1:UE9pLhzmWf+xHNmZsoccjXosPicuiNaInPgym8nzfg0=
|
||||||
github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||||
github.com/golang/lint v0.0.0-20181026193005-c67002cb31c3 h1:I4BOK3PBMjhWfQM2zPJKK7lOBGsrsvOB7kBELP33hiE=
|
|
||||||
github.com/golang/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E=
|
|
||||||
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
github.com/lukehoban/go-find-references v0.0.0-20150918174914-42505ef666d1 h1:F7r7JiLNObE2d4z82V3/cUfW5alV6YY89LQtK0qcUQc=
|
|
||||||
github.com/lukehoban/go-find-references v0.0.0-20150918174914-42505ef666d1/go.mod h1:T8xMbBjUvlaQRNZdgSoPLks3kZlAemyqb6HJPHyOUek=
|
|
||||||
github.com/lukehoban/go-outline v0.0.0-20161011150102-e78556874252 h1:D2VNityLQ1srKF+MSllSGQ4NwMci20llMkvVAmU2aCk=
|
|
||||||
github.com/lukehoban/go-outline v0.0.0-20161011150102-e78556874252/go.mod h1:O9bIJ6BRFBmP3AKTW8cqESVbauSmifSrRB/n9zq6x9Q=
|
|
||||||
github.com/lukehoban/ident v0.0.0-20161021214352-ec6acfba39eb h1:hLP73jhKhyayGVSX48TiA1qjMatiBpG7uc2zIsqy7yk=
|
|
||||||
github.com/lukehoban/ident v0.0.0-20161021214352-ec6acfba39eb/go.mod h1:Znk/A72lIyE/q043nd5s5tg63q2rCEohe6Gn8Yo4VdU=
|
|
||||||
github.com/newhook/go-symbols v0.0.0-20151212134530-b75dfefa0d23 h1:bXKgb2O/gIrZd/smUeP3OJcAt1ey3UV+cPYT+mRUNzs=
|
|
||||||
github.com/newhook/go-symbols v0.0.0-20151212134530-b75dfefa0d23/go.mod h1:9RIESfVnNNAkdTKNuEYS0rEkXXM2HYfchPD4xXNx1CU=
|
|
||||||
github.com/nsf/gocode v0.0.0-20180902125341-7b1d4e18cdc5 h1:V2BSh6DxcqZrEId1t9k3V7CXJQEpu50cVko4PyrwDb4=
|
|
||||||
github.com/nsf/gocode v0.0.0-20180902125341-7b1d4e18cdc5/go.mod h1:6Q8/OMaaKAgTX7/jt2bOXVDrm1eJhoNd+iwzghR7jvs=
|
|
||||||
github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw=
|
github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw=
|
||||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
github.com/onsi/gomega v1.4.2 h1:3mYCb7aPxS/RU7TI1y4rkEn1oKmPRjNJLNEXgw7MH2I=
|
github.com/onsi/gomega v1.4.2 h1:3mYCb7aPxS/RU7TI1y4rkEn1oKmPRjNJLNEXgw7MH2I=
|
||||||
github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||||
github.com/rogpeppe/godef v1.0.0 h1:+3JM5juQRFS/Vifg5lMHkAtRELpcGicuZXdBmf7NIhE=
|
|
||||||
github.com/rogpeppe/godef v1.0.0/go.mod h1:FWOCnfqToTbJkUGS32JdUoCuBBjtBQ3ZawrP7InscsM=
|
|
||||||
github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518 h1:iD+PFTQwKEmbwSdwfvP5ld2WEI/g7qbdhmHJ2ASfYGs=
|
|
||||||
github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518/go.mod h1:CKI4AZ4XmGV240rTHfO0hfE83S6/a3/Q1siZJ/vXf7A=
|
|
||||||
github.com/tpng/gopkgs v0.0.0-20180428091733-81e90e22e204 h1:nQYpoEpKTbArT17ogHCrMfsM4CCGiOdtQMuZJxeu8lQ=
|
|
||||||
github.com/tpng/gopkgs v0.0.0-20180428091733-81e90e22e204/go.mod h1:MwY6Iwya1EJi2InQFe7g/J3Qr7eik70yycN5+sw03hQ=
|
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||||
@ -47,7 +26,3 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep
|
|||||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||||
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
|
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
|
||||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
sourcegraph.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518 h1:hK6WwmQDFDRBBDeN/+3lcp1NoDn0ptGiJhxIpvzpqCw=
|
|
||||||
sourcegraph.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518/go.mod h1:Hm3i1Xmrc6guw1/fGxmO0PIGpbmXAQsJ8LhIQncGYwo=
|
|
||||||
yumc.pw/cloud/docker-image-sync v0.0.0-20181029103637-0be3e70228f3 h1:963GsCDM0C1wNTG/UBDQ4aYCPvkFRnj4YSce5pj5whw=
|
|
||||||
yumc.pw/cloud/docker-image-sync v0.0.0-20181029103637-0be3e70228f3/go.mod h1:ZY9otb70bNCEGplod222rkpZ6P5ilIDxOUs5BIPUAjg=
|
|
||||||
|
9
main.go
9
main.go
@ -105,15 +105,10 @@ func checkMirror(image string) bool {
|
|||||||
func handleNormal(resp http.ResponseWriter, req *http.Request) {
|
func handleNormal(resp http.ResponseWriter, req *http.Request) {
|
||||||
fmt.Println("[N] " + req.RequestURI)
|
fmt.Println("[N] " + req.RequestURI)
|
||||||
|
|
||||||
if strings.Contains(req.RequestURI, ".ico") || strings.Contains(req.RequestURI, ".txt") {
|
|
||||||
resp.Write([]byte("Noop..."))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
origin := subString(req.RequestURI, 1, len(req.RequestURI))
|
origin := subString(req.RequestURI, 1, len(req.RequestURI))
|
||||||
|
|
||||||
if strings.Contains(origin, target) {
|
if origin == "" || strings.Contains(origin, "?") || strings.Contains(origin, "=") || strings.Contains(req.RequestURI, ".ico") || strings.Contains(req.RequestURI, ".txt") || strings.Contains(origin, target) {
|
||||||
resp.Write([]byte("Image " + origin + " Is Self Can't Sync..."))
|
resp.Write([]byte("Noop..."))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user