mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-11-07 07:09:46 +00:00
wip
This commit is contained in:
parent
43cc7596d2
commit
b20af1b5fd
2
go.mod
2
go.mod
@ -4,7 +4,7 @@ go 1.16
|
||||
|
||||
require (
|
||||
github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d
|
||||
github.com/IceWhaleTech/CasaOS-Common v0.3.7-1
|
||||
github.com/IceWhaleTech/CasaOS-Common v0.3.7-3.0.20221103002808-1a35e17aba37
|
||||
github.com/IceWhaleTech/CasaOS-Gateway v0.3.6
|
||||
github.com/Microsoft/go-winio v0.5.0 // indirect
|
||||
github.com/ambelovsky/go-structs v1.1.0 // indirect
|
||||
|
||||
4
go.sum
4
go.sum
@ -84,8 +84,8 @@ github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d
|
||||
github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d/go.mod h1:lW9x+yEjqKdPbE3+cf2fGPJXCw/hChX3Omi9QHTLFsQ=
|
||||
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
|
||||
github.com/IceWhaleTech/CasaOS-Common v0.0.0-20220901034123-ca130f6b5ce9/go.mod h1:2MiivEMzvh41codhEKUcn46WK3Ffesop/04qa9jsvQk=
|
||||
github.com/IceWhaleTech/CasaOS-Common v0.3.7-1 h1:paay9dFGAWjNcjtCrN6ymvuU21KtxPoIpNG3wo10ufk=
|
||||
github.com/IceWhaleTech/CasaOS-Common v0.3.7-1/go.mod h1:2MiivEMzvh41codhEKUcn46WK3Ffesop/04qa9jsvQk=
|
||||
github.com/IceWhaleTech/CasaOS-Common v0.3.7-3.0.20221103002808-1a35e17aba37 h1:ACPVZCCFjnl8sKcqSeGkofY56vWdGCw5suQflNQLccc=
|
||||
github.com/IceWhaleTech/CasaOS-Common v0.3.7-3.0.20221103002808-1a35e17aba37/go.mod h1:2MiivEMzvh41codhEKUcn46WK3Ffesop/04qa9jsvQk=
|
||||
github.com/IceWhaleTech/CasaOS-Gateway v0.3.6 h1:2tQQo85+jzbbjqIsKKn77QlAA73bc7vZsVCFvWnK4mg=
|
||||
github.com/IceWhaleTech/CasaOS-Gateway v0.3.6/go.mod h1:hnZwGUzcOyiufMpVO7l3gu2gAm6Ws4TY4Nlj3kMshXA=
|
||||
github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
|
||||
|
||||
@ -2,6 +2,7 @@ package v1
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
@ -342,11 +343,23 @@ func GetSystemNetInfo(c *gin.Context) {
|
||||
|
||||
func GetSystemProxy(c *gin.Context) {
|
||||
url := c.Query("url")
|
||||
resp, err := http.Get(url)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, model.Result{Success: common_err.SERVICE_ERROR, Message: err.Error(), Data: nil})
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := http.DefaultClient.Do(request)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, model.Result{Success: common_err.SERVICE_ERROR, Message: err.Error(), Data: nil})
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
for k, v := range c.Request.Header {
|
||||
c.Header(k, v[0])
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user