mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 13:14:11 +00:00
feat(nodes): add allow-private-address toggle per node
Adds AllowPrivateAddress to the Node model (DB default false). When enabled it bypasses the SSRF private-range check for that node's probe URL, allowing nodes hosted on RFC-1918 or loopback addresses (e.g. a private VPN or LAN setup).
This commit is contained in:
parent
5ffd896a7c
commit
6343c43f62
2 changed files with 17 additions and 9 deletions
|
|
@ -128,15 +128,16 @@ type Setting struct {
|
||||||
// endpoint over HTTP using the per-node ApiToken to populate the runtime
|
// endpoint over HTTP using the per-node ApiToken to populate the runtime
|
||||||
// status fields below.
|
// status fields below.
|
||||||
type Node struct {
|
type Node struct {
|
||||||
Id int `json:"id" form:"id" gorm:"primaryKey;autoIncrement"`
|
Id int `json:"id" form:"id" gorm:"primaryKey;autoIncrement"`
|
||||||
Name string `json:"name" form:"name" gorm:"uniqueIndex"`
|
Name string `json:"name" form:"name" gorm:"uniqueIndex"`
|
||||||
Remark string `json:"remark" form:"remark"`
|
Remark string `json:"remark" form:"remark"`
|
||||||
Scheme string `json:"scheme" form:"scheme"`
|
Scheme string `json:"scheme" form:"scheme"`
|
||||||
Address string `json:"address" form:"address"`
|
Address string `json:"address" form:"address"`
|
||||||
Port int `json:"port" form:"port"`
|
Port int `json:"port" form:"port"`
|
||||||
BasePath string `json:"basePath" form:"basePath"`
|
BasePath string `json:"basePath" form:"basePath"`
|
||||||
ApiToken string `json:"apiToken" form:"apiToken"`
|
ApiToken string `json:"apiToken" form:"apiToken"`
|
||||||
Enable bool `json:"enable" form:"enable" gorm:"default:true"`
|
Enable bool `json:"enable" form:"enable" gorm:"default:true"`
|
||||||
|
AllowPrivateAddress bool `json:"allowPrivateAddress" form:"allowPrivateAddress" gorm:"default:false"`
|
||||||
|
|
||||||
// Heartbeat-updated fields. UpdatedAt advances on every probe even when
|
// Heartbeat-updated fields. UpdatedAt advances on every probe even when
|
||||||
// the row is otherwise unchanged so the UI's "last seen" tooltip is
|
// the row is otherwise unchanged so the UI's "last seen" tooltip is
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ function defaultForm() {
|
||||||
basePath: '/',
|
basePath: '/',
|
||||||
apiToken: '',
|
apiToken: '',
|
||||||
enable: true,
|
enable: true,
|
||||||
|
allowPrivateAddress: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,6 +70,7 @@ function buildPayload() {
|
||||||
basePath: form.basePath?.trim() || '/',
|
basePath: form.basePath?.trim() || '/',
|
||||||
apiToken: form.apiToken?.trim() || '',
|
apiToken: form.apiToken?.trim() || '',
|
||||||
enable: !!form.enable,
|
enable: !!form.enable,
|
||||||
|
allowPrivateAddress: !!form.allowPrivateAddress,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,6 +163,11 @@ async function onSave() {
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
|
<a-form-item label="Allow private address">
|
||||||
|
<a-switch v-model:checked="form.allowPrivateAddress" />
|
||||||
|
<div class="hint">Enable only for nodes on a private network or VPN.</div>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item :label="t('pages.nodes.apiToken')" required>
|
<a-form-item :label="t('pages.nodes.apiToken')" required>
|
||||||
<a-input-password v-model:value="form.apiToken" :placeholder="t('pages.nodes.apiTokenPlaceholder')" />
|
<a-input-password v-model:value="form.apiToken" :placeholder="t('pages.nodes.apiTokenPlaceholder')" />
|
||||||
<div class="hint">{{ t('pages.nodes.apiTokenHint') }}</div>
|
<div class="hint">{{ t('pages.nodes.apiTokenHint') }}</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue