From 37c1bc375d5417215ba6fb188fc51640f0171666 Mon Sep 17 00:00:00 2001 From: yiguo Date: Sun, 17 Nov 2024 12:42:09 +0800 Subject: [PATCH 1/2] using original config to parse share links --- infra/conf/common.go | 4 ++++ infra/conf/xray.go | 1 + 2 files changed, 5 insertions(+) diff --git a/infra/conf/common.go b/infra/conf/common.go index ccd36d3d511f..fd6e732a3c62 100644 --- a/infra/conf/common.go +++ b/infra/conf/common.go @@ -42,6 +42,10 @@ type Address struct { net.Address } +func (v Address) MarshalJSON() ([]byte, error) { + return json.Marshal(v.Address.String()) +} + func (v *Address) UnmarshalJSON(data []byte) error { var rawStr string if err := json.Unmarshal(data, &rawStr); err != nil { diff --git a/infra/conf/xray.go b/infra/conf/xray.go index ee9e6dfd81b2..a26ed7412409 100644 --- a/infra/conf/xray.go +++ b/infra/conf/xray.go @@ -258,6 +258,7 @@ func (c *InboundDetourConfig) Build() (*core.InboundHandlerConfig, error) { } type OutboundDetourConfig struct { + Name *string `json:"name"` Protocol string `json:"protocol"` SendThrough *string `json:"sendThrough"` Tag string `json:"tag"` From c54c40225b09ef2bb80e3a6bc99cffbfbe012917 Mon Sep 17 00:00:00 2001 From: yiguo Date: Sun, 17 Nov 2024 18:52:42 +0800 Subject: [PATCH 2/2] rm name field --- infra/conf/xray.go | 1 - 1 file changed, 1 deletion(-) diff --git a/infra/conf/xray.go b/infra/conf/xray.go index a26ed7412409..ee9e6dfd81b2 100644 --- a/infra/conf/xray.go +++ b/infra/conf/xray.go @@ -258,7 +258,6 @@ func (c *InboundDetourConfig) Build() (*core.InboundHandlerConfig, error) { } type OutboundDetourConfig struct { - Name *string `json:"name"` Protocol string `json:"protocol"` SendThrough *string `json:"sendThrough"` Tag string `json:"tag"`