From efd11d24fb43324978f2b467bcd27fb0ae307704 Mon Sep 17 00:00:00 2001 From: mzz2017 Date: Wed, 29 Sep 2021 15:26:13 +0800 Subject: [PATCH] feat: observatory window --- gui/src/App.vue | 59 +++++++++++++++- gui/src/components/modalOutboundSetting.vue | 33 +++++++-- gui/src/node.vue | 8 ++- service/core/specialMode/infra/whitelistcn.go | 14 ++-- service/core/specialMode/supervisor_linux.go | 7 +- service/core/v2ray/api.go | 68 ++++++++++++------- service/core/v2ray/process.go | 2 +- service/core/v2ray/v2rayTmpl.go | 3 +- service/go.mod | 3 +- service/go.sum | 33 ++++++--- service/server/controller/message.go | 1 + 11 files changed, 174 insertions(+), 57 deletions(-) diff --git a/gui/src/App.vue b/gui/src/App.vue index f3451411..cb8b5bc8 100644 --- a/gui/src/App.vue +++ b/gui/src/App.vue @@ -158,7 +158,7 @@ import { waitingConnected } from "./assets/js/networkInspect"; import axios from "./plugins/axios"; export default { - components: { ModalCustomAddress, node, ModalOutboundSetting }, + components: { ModalCustomAddress, node }, data() { return { ws: null, @@ -183,7 +183,7 @@ export default { outboundName: "proxy", outbounds: ["proxy"], outboundDropdownHover: {}, - updateOutboundDropdown: true, + updateOutboundDropdown: true }; }, computed: { @@ -307,7 +307,10 @@ export default { this.ws = ws; }, handleMessage(msg) { - if (msg.type === "observatory") { + if ( + msg.type === "observatory" && + msg.body.outboundName === this.outboundName + ) { this.observatory = msg; } }, @@ -376,8 +379,53 @@ export default { } }); }, + handleDeleteOutbound(outbound) { + let cancel; + waitingConnected( + this.$axios({ + url: apiRoot + "/outbound", + method: "delete", + data: { + outbound + }, + cancelToken: new axios.CancelToken(function executor(c) { + cancel = c; + }) + }).then(res => { + if (res.data.code === "SUCCESS") { + this.$buefy.toast.open({ + message: this.$t("common.success"), + type: "is-success", + duration: 2000, + position: "is-top", + queue: false + }); + this.outbounds = res.data.data.outbounds; + if (this.outboundName === outbound) { + this.outboundName = "proxy"; + } + if (outbound in this.runningState.outboundToServerName) { + this.runningState.connectedServer = this.runningState.connectedServer.filter( + cs => cs.outbound !== outbound + ); + } + } else { + this.$buefy.toast.open({ + message: res.data.message, + type: "is-warning", + duration: 5000, + position: "is-top", + queue: false + }); + } + }), + 3 * 1000, + cancel + ); + }, handleClickOutboundSetting(event, outbound) { event.stopPropagation(); + const that = this; this.$buefy.modal.open({ parent: this, component: ModalOutboundSetting, @@ -385,6 +433,11 @@ export default { canCancel: true, props: { outbound: outbound + }, + events: { + delete() { + that.handleDeleteOutbound(outbound); + } } }); }, diff --git a/gui/src/components/modalOutboundSetting.vue b/gui/src/components/modalOutboundSetting.vue index f71986c6..3168a3db 100644 --- a/gui/src/components/modalOutboundSetting.vue +++ b/gui/src/components/modalOutboundSetting.vue @@ -26,12 +26,17 @@ @@ -70,6 +75,24 @@ export default { }); }, methods: { + handleClickDelete() { + const that = this; + this.$buefy.dialog.confirm({ + title: that.$t("delete.title"), + message: that.$t("outbound.deleteMessage", { + outboundName: that.outbound + }), + confirmText: that.$t("operations.delete"), + cancelText: that.$t("operations.cancel"), + type: "is-danger", + hasIcon: true, + icon: " iconfont icon-alert", + onConfirm: () => { + that.$emit("delete"); + that.$parent.close(); + } + }); + }, handleClickSubmit() { let valid = true; for (let k in this.$refs) { diff --git a/gui/src/node.vue b/gui/src/node.vue index cb26abbd..7605d13a 100644 --- a/gui/src/node.vue +++ b/gui/src/node.vue @@ -765,7 +765,7 @@ export default { } }, observatory(val) { - for (const info of val.body) { + for (const info of val.body.outboundStatus) { this.connectedServerInfo.some(x => { if ( info.which._type === x.which._type && @@ -902,7 +902,7 @@ export default { console.warn("node not found"); return; } - node.scrollIntoView({ block: "end", inline: "center" }); + node.scrollIntoView({ block: "center", inline: "center" }); let highlightClass = "highlight-row-connected"; if (that.runningState.running !== that.$t("common.isRunning")) { highlightClass = "highlight-row-disconnected"; @@ -1078,6 +1078,10 @@ export default { this.connectedServerInfo = []; } + this.connectedServerInfo.sort((x, y) => { + return x.info.name > y.info.name; + }); + this.connectedServerInTab.server = false; for (const i in this.connectedServerInTab.subscriptionServer) { this.connectedServerInTab.subscriptionServer[i] = false; diff --git a/service/core/specialMode/infra/whitelistcn.go b/service/core/specialMode/infra/whitelistcn.go index fd8a97ed..96bb9fc9 100644 --- a/service/core/specialMode/infra/whitelistcn.go +++ b/service/core/specialMode/infra/whitelistcn.go @@ -3,7 +3,7 @@ package infra import ( "fmt" "github.com/golang/protobuf/proto" - v2router "github.com/v2fly/v2ray-core/v4/app/router" + "github.com/v2fly/v2ray-core/v4/app/router/routercommon" "github.com/v2fly/v2ray-core/v4/common/strmatcher" "github.com/v2rayA/v2rayA/core/v2ray/asset" "os" @@ -17,14 +17,14 @@ var whitelistCn struct { sync.Mutex } -func GetWhitelistCn(externDomains []*v2router.Domain) (wlDomains *strmatcher.MatcherGroup, err error) { +func GetWhitelistCn(externDomains []*routercommon.Domain) (wlDomains *strmatcher.MatcherGroup, err error) { whitelistCn.Lock() defer whitelistCn.Unlock() if whitelistCn.domainMatcher != nil { return whitelistCn.domainMatcher, nil } dir := asset.GetV2rayLocationAsset() - var siteList v2router.GeoSiteList + var siteList routercommon.GeoSiteList b, err := os.ReadFile(path.Join(dir, "geosite.dat")) if err != nil { return nil, fmt.Errorf("GetWhitelistCn: %w", err) @@ -42,13 +42,13 @@ func GetWhitelistCn(externDomains []*v2router.Domain) (wlDomains *strmatcher.Mat dms = append(dms, externDomains...) for _, dm := range dms { switch dm.Type { - case v2router.Domain_Domain: + case routercommon.Domain_RootDomain: domainMatcher.Add(dm.Value) - case v2router.Domain_Full: + case routercommon.Domain_Full: fullMatcher.Add(dm.Value) - case v2router.Domain_Plain: + case routercommon.Domain_Plain: wlDomains.Add(SubstrMatcher(dm.Value)) - case v2router.Domain_Regex: + case routercommon.Domain_Regex: r, err := regexp.Compile(dm.Value) if err != nil { break diff --git a/service/core/specialMode/supervisor_linux.go b/service/core/specialMode/supervisor_linux.go index b997dda5..08242ae1 100644 --- a/service/core/specialMode/supervisor_linux.go +++ b/service/core/specialMode/supervisor_linux.go @@ -3,6 +3,7 @@ package specialMode import ( "fmt" "github.com/v2fly/v2ray-core/v4/app/router" + "github.com/v2fly/v2ray-core/v4/app/router/routercommon" "github.com/v2rayA/v2rayA/conf" "github.com/v2rayA/v2rayA/core/specialMode/infra" "github.com/v2rayA/v2rayA/db/configure" @@ -17,8 +18,8 @@ var ( done chan interface{} mutex sync.Mutex limit = make(chan interface{}, 1) - whiteDnsServerIps []*router.CIDR - whiteDomains []*router.Domain + whiteDnsServerIps []*routercommon.CIDR + whiteDomains []*routercommon.Domain wg sync.WaitGroup ) @@ -52,7 +53,7 @@ func CheckAndSetupDNSSupervisor() { nil) } -func StartDNSSupervisor(externWhiteDnsServers []*router.CIDR, externWhiteDomains []*router.Domain) (err error) { +func StartDNSSupervisor(externWhiteDnsServers []*routercommon.CIDR, externWhiteDomains []*routercommon.Domain) (err error) { defer func() { if err != nil { err = fmt.Errorf("StartDNSSupervisor: %w", err) diff --git a/service/core/v2ray/api.go b/service/core/v2ray/api.go index adbcee3f..cfecf0f0 100644 --- a/service/core/v2ray/api.go +++ b/service/core/v2ray/api.go @@ -3,6 +3,7 @@ package v2ray import ( "context" "github.com/devfeel/mapper" + "github.com/gin-gonic/gin" "github.com/v2fly/v2ray-core/v4/app/observatory" pb "github.com/v2fly/v2ray-core/v4/app/observatory/command" "github.com/v2rayA/v2rayA/db/configure" @@ -28,13 +29,13 @@ const ( ) type OutboundStatus struct { - Alive bool `json:"alive"` - Delay int64 `json:"delay"` - LastErrorReason string `json:"last_error_reason"` - OutboundTag string `json:"outbound_tag"` - Which *configure.Which `json:"which"` - LastSeenTime int64 `json:"last_seen_time"` - LastTryTime int64 `json:"last_try_time"` + Alive bool `json:"alive"` + Delay int64 `json:"delay"` + //LastErrorReason string `json:"last_error_reason"` + OutboundTag string `json:"outbound_tag"` + Which *configure.Which `json:"which"` + LastSeenTime int64 `json:"last_seen_time"` + LastTryTime int64 `json:"last_try_time"` } func init() { @@ -46,14 +47,27 @@ func init() { } } -func getObservatoryResponse(conn *grpc.ClientConn) (r *pb.GetOutboundStatusResponse, err error) { +type ObservatoryResp struct { + OutboundName string + Resp *pb.GetOutboundStatusResponse +} + +func getObservatoryResponses(conn *grpc.ClientConn, outboundNames []string) (r []ObservatoryResp, err error) { c := pb.NewObservatoryServiceClient(conn) ctx, cancel := context.WithTimeout(context.Background(), time.Second) defer cancel() - r, err = c.GetOutboundStatus(ctx, &pb.GetOutboundStatusRequest{}) - if err != nil { - return nil, err + if len(outboundNames) == 0 { + outboundNames = append(outboundNames, "") + } + for _, name := range outboundNames { + resp, err := c.GetOutboundStatus(ctx, &pb.GetOutboundStatusRequest{ + Tag: name, + }) + if err != nil { + return nil, err + } + r = append(r, ObservatoryResp{OutboundName: name, Resp: resp}) } return r, nil } @@ -92,7 +106,7 @@ func ObservatoryProducer(apiPort int) (closeFunc func()) { defer c.Close() conn = c } - r, err := getObservatoryResponse(conn) + resps, err := getObservatoryResponses(conn, configure.GetOutbounds()) if err != nil { if status.Code(err) == codes.Unavailable { // the connection is reliable, and reconnect @@ -101,22 +115,28 @@ func ObservatoryProducer(apiPort int) (closeFunc func()) { } log.Warn("ObservatoryProducer: %v", err) } else { - outboundStatus := r.GetStatus().GetStatus() - os := make([]OutboundStatus, len(outboundStatus)) css := configure.GetConnectedServers() - for i := range outboundStatus { - _ = mapper.AutoMapper(outboundStatus[i], &os[i]) - index := p.tag2WhichIndex[os[i].OutboundTag] - if index >= css.Len() { - continue nextLoop + for _, r := range resps { + outboundStatus := r.Resp.GetStatus().GetStatus() + os := make([]OutboundStatus, len(outboundStatus)) + for i := range outboundStatus { + _ = mapper.AutoMapper(outboundStatus[i], &os[i]) + index := p.tag2WhichIndex[os[i].OutboundTag] + if index >= css.Len() { + continue nextLoop + } + os[i].Which = css.Get()[index] + var w []configure.Which + for _, v := range css.Get() { + w = append(w, *v) + } } - os[i].Which = css.Get()[index] - var w []configure.Which - for _, v := range css.Get() { - w = append(w, *v) + msg := gin.H{ + "outboundName": r.OutboundName, + "outboundStatus": os, } + ApiFeed.ProductMessage(product, msg) } - ApiFeed.ProductMessage(product, os) } time.Sleep(ApiFeedInterval) } diff --git a/service/core/v2ray/process.go b/service/core/v2ray/process.go index 487e664a..0ba78568 100644 --- a/service/core/v2ray/process.go +++ b/service/core/v2ray/process.go @@ -31,7 +31,7 @@ func NewProcess(tmpl *Template) (process *Process, err error) { process = &Process{ template: tmpl, } - if tmpl.Observatory != nil { + if tmpl.MultiObservatory != nil { // NOTICE: tag2WhichIndex is reliable because once connected servers are changed when v2ray is running, // the func UpdateV2RayConfig should be invoked and tag2WhichIndex will be regenerated. tag2WhichIndex := make(map[string]int) diff --git a/service/core/v2ray/v2rayTmpl.go b/service/core/v2ray/v2rayTmpl.go index 1663580f..430902fe 100644 --- a/service/core/v2ray/v2rayTmpl.go +++ b/service/core/v2ray/v2rayTmpl.go @@ -44,7 +44,6 @@ type Template struct { } `json:"routing"` DNS *coreObj.DNS `json:"dns,omitempty"` FakeDns *coreObj.FakeDns `json:"fakedns,omitempty"` - Observatory *coreObj.Observatory `json:"observatory,omitempty"` MultiObservatory *coreObj.MultiObservatory `json:"multiObservatory,omitempty"` API *coreObj.APIObject `json:"api,omitempty"` @@ -1405,7 +1404,7 @@ func (t *Template) SetAPI() (port int) { } time.Sleep(100 * time.Millisecond) } - if t.Observatory != nil { + if t.MultiObservatory != nil { services = append(services, "ObservatoryService") t.ApiCloses = append(t.ApiCloses, ObservatoryProducer(port)) } diff --git a/service/go.mod b/service/go.mod index 667feda0..cde3f667 100644 --- a/service/go.mod +++ b/service/go.mod @@ -24,7 +24,7 @@ require ( github.com/shirou/gopsutil/v3 v3.21.8 github.com/stevenroose/gonfig v0.1.5 github.com/tidwall/gjson v1.7.5 - github.com/v2fly/v2ray-core/v4 v4.42.2 + github.com/v2fly/v2ray-core/v4 v4.42.2-0.20210928173456-a9979057dcaa github.com/v2rayA/RoutingA v1.0.0 github.com/v2rayA/beego/v2 v2.0.4 github.com/v2rayA/go-uci v0.0.0-20210907104827-4cf744297b41 @@ -33,7 +33,6 @@ require ( golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f golang.org/x/sys v0.0.0-20210903071746-97244b99971b google.golang.org/grpc v1.40.0 - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) // Replace dependency modules with local developing copy diff --git a/service/go.sum b/service/go.sum index a8b8545b..f3a0b975 100644 --- a/service/go.sum +++ b/service/go.sum @@ -63,6 +63,7 @@ github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7 github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -112,6 +113,10 @@ github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwv github.com/gin-gonic/gin v1.7.1 h1:qC89GU3p8TvKWMAVhEpmpB2CIb1hnqt2UdKZaP93mS8= github.com/gin-gonic/gin v1.7.1/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/go-chi/chi/v5 v5.0.4 h1:5e494iHzsYBiyXQAHHuI4tyJS9M3V84OuX3ufIIGHFo= +github.com/go-chi/chi/v5 v5.0.4/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-chi/render v1.0.1 h1:4/5tis2cKaNdnv9zFLfXzcquC9HbeZgCnxGnKrltBS8= +github.com/go-chi/render v1.0.1/go.mod h1:pq4Rr7HbnsdaeHagklXub+p6Wd16Af5l9koip1OvJns= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= @@ -122,14 +127,17 @@ github.com/go-ole/go-ole v0.0.0-20210915003542-8b1f7f90f6b1/go.mod h1:pprOEPIfld github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= -github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= +github.com/go-playground/validator/v10 v10.9.0 h1:NgTtmN58D0m8+UuxtYmGztBJB7VnPgjj221I1QHci2A= +github.com/go-playground/validator/v10 v10.9.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= @@ -252,15 +260,18 @@ github.com/klauspost/reedsolomon v1.9.9/go.mod h1:O7yFFHiQwDR6b2t63KPUpccPtNdp5A github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/lucas-clemente/quic-go v0.23.0 h1:5vFnKtZ6nHDFsc/F3uuiF4T3y/AXaQdxjUqiVw26GZE= github.com/lucas-clemente/quic-go v0.23.0/go.mod h1:paZuzjXCE5mj6sikVLMvqXk8lJV2AsqtJ6bDhjEfxx0= github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 h1:EnfXoSqDfSNJv0VBNqY/88RNnhSGYkrHaO0mmFGbVsc= @@ -344,6 +355,7 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2/go.mod h1:iIss55rKnNBTvrwdmkUpLnDpZoAHvWaiq5+iMmen4AE= github.com/pires/go-proxyproto v0.6.1 h1:EBupykFmo22SDjv4fQVQd2J9NOoLPmyZA/15ldOGkPw= github.com/pires/go-proxyproto v0.6.1/go.mod h1:Odh9VFOZJCf9G8cLW5o435Xf1J95Jw9Gw5rnCjcwzAY= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -369,6 +381,9 @@ github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3/go.mod h1:HgjTstv github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= @@ -459,8 +474,8 @@ github.com/v2fly/VSign v0.0.0-20201108000810-e2adc24bf848 h1:p1UzXK6VAutXFFQMnre github.com/v2fly/VSign v0.0.0-20201108000810-e2adc24bf848/go.mod h1:p80Bv154ZtrGpXMN15slDCqc9UGmfBuUzheDFBYaW/M= github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e h1:5QefA066A1tF8gHIiADmOVOV5LS43gt3ONnlEl3xkwI= github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e/go.mod h1:5t19P9LBIrNamL6AcMQOncg/r10y3Pc01AbHeMhwlpU= -github.com/v2fly/v2ray-core/v4 v4.42.2 h1:/wXB4yrB480JaK+SGBkIT3qopelwVyRe6JxkG8p7rXo= -github.com/v2fly/v2ray-core/v4 v4.42.2/go.mod h1:MB2YZ6JUC0eNWXZHL2rDMG7S5vZqvC/8++lQgqnTOh4= +github.com/v2fly/v2ray-core/v4 v4.42.2-0.20210928173456-a9979057dcaa h1:MyrHPDN4JhKoOvBOK8UUVoXd4Pd9AoIfbLClTPEbKt4= +github.com/v2fly/v2ray-core/v4 v4.42.2-0.20210928173456-a9979057dcaa/go.mod h1:6wk/2dqqbvcRFSLcSRR5GNfjMrcJcephXmA1HjZs0Pg= github.com/v2rayA/RoutingA v1.0.0 h1:0SC9MacoSwdmTV3SWtp7XUY3PC05+vPcBh9GSlWjYrI= github.com/v2rayA/RoutingA v1.0.0/go.mod h1:f5pkOS7f5YsjdSNWLTOTzv0/DaldMP0OeVY8Fi/G12g= github.com/v2rayA/beego/v2 v2.0.4 h1:rnlnGhip6akWhl7gUw0lYiW0x+9Q9q4eba+bBQgSCnY= @@ -524,6 +539,7 @@ golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -659,6 +675,7 @@ golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210903071746-97244b99971b h1:3Dq0eVHn0uaQJmPO+/aYPI/fRMqdrVDbu7MQcku54gg= golang.org/x/sys v0.0.0-20210903071746-97244b99971b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= diff --git a/service/server/controller/message.go b/service/server/controller/message.go index d69ae036..110ca73b 100644 --- a/service/server/controller/message.go +++ b/service/server/controller/message.go @@ -13,6 +13,7 @@ var upgrader = websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { return true }, + EnableCompression: true, } func WsMessage(ctx *gin.Context) {