diff --git a/frontend/src/models/outbound.js b/frontend/src/models/outbound.js index ca5f5d36..645f6100 100644 --- a/frontend/src/models/outbound.js +++ b/frontend/src/models/outbound.js @@ -12,6 +12,7 @@ export const Protocols = { Hysteria: "hysteria", Socks: "socks", HTTP: "http", + Loopback: "loopback", }; export const SSMethods = { @@ -1586,6 +1587,7 @@ Outbound.Settings = class extends CommonClass { case Protocols.HTTP: return new Outbound.HttpSettings(); case Protocols.Wireguard: return new Outbound.WireguardSettings(); case Protocols.Hysteria: return new Outbound.HysteriaSettings(); + case Protocols.Loopback: return new Outbound.LoopbackSettings(); default: return null; } } @@ -1603,6 +1605,7 @@ Outbound.Settings = class extends CommonClass { case Protocols.HTTP: return Outbound.HttpSettings.fromJson(json); case Protocols.Wireguard: return Outbound.WireguardSettings.fromJson(json); case Protocols.Hysteria: return Outbound.HysteriaSettings.fromJson(json); + case Protocols.Loopback: return Outbound.LoopbackSettings.fromJson(json); default: return null; } } @@ -1782,6 +1785,23 @@ Outbound.BlackholeSettings = class extends CommonClass { } }; +Outbound.LoopbackSettings = class extends CommonClass { + constructor(inboundTag = '') { + super(); + this.inboundTag = inboundTag; + } + + static fromJson(json = {}) { + return new Outbound.LoopbackSettings(json.inboundTag || ''); + } + + toJson() { + return { + inboundTag: this.inboundTag || undefined, + }; + } +}; + Outbound.DNSRule = class extends CommonClass { constructor(action = 'direct', qtype = '', domain = '') { super(); diff --git a/frontend/src/pages/xray/OutboundFormModal.vue b/frontend/src/pages/xray/OutboundFormModal.vue index 324d91d2..b49c3c31 100644 --- a/frontend/src/pages/xray/OutboundFormModal.vue +++ b/frontend/src/pages/xray/OutboundFormModal.vue @@ -34,6 +34,7 @@ const props = defineProps({ open: { type: Boolean, default: false }, outbound: { type: Object, default: null }, existingTags: { type: Array, default: () => [] }, + inboundTags: { type: Array, default: () => [] }, }); const emit = defineEmits(['update:open', 'confirm']); @@ -199,6 +200,7 @@ const isBlackhole = computed(() => proto.value === Protocols.Blackhole); const isDNS = computed(() => proto.value === Protocols.DNS); const isWireguard = computed(() => proto.value === Protocols.Wireguard); const isHysteria = computed(() => proto.value === Protocols.Hysteria); +const isLoopback = computed(() => proto.value === Protocols.Loopback); function regenerateWgKeys() { if (!outbound.value?.settings) return; @@ -311,6 +313,16 @@ function regenerateWgKeys() { + + +