diff --git a/app/db/crud.py b/app/db/crud.py index 7f2e52cae..0aa0adccd 100644 --- a/app/db/crud.py +++ b/app/db/crud.py @@ -83,8 +83,6 @@ def update_hosts(db: Session, inbound_tag: str, modified_hosts: List[ProxyHostMo fingerprint=host.fingerprint, allowinsecure=host.allowinsecure, is_disabled=host.is_disabled, - sockopt=host.sockopt, - proxy_outbound=host.proxy_outbound, fragment_setting=host.fragment_setting, ) for host in modified_hosts ] diff --git a/app/db/migrations/versions/4f045f53bef8_drop_proxy_outbound_and_sockopt_from_.py b/app/db/migrations/versions/4f045f53bef8_drop_proxy_outbound_and_sockopt_from_.py new file mode 100644 index 000000000..5d55deb10 --- /dev/null +++ b/app/db/migrations/versions/4f045f53bef8_drop_proxy_outbound_and_sockopt_from_.py @@ -0,0 +1,26 @@ +"""drop proxy_outbound and sockopt from hosts + +Revision ID: 4f045f53bef8 +Revises: 1ad79b97fdcf +Create Date: 2024-02-28 20:45:33.206410 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import mysql + +# revision identifiers, used by Alembic. +revision = '4f045f53bef8' +down_revision = '1ad79b97fdcf' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.drop_column('hosts', 'proxy_outbound') + op.drop_column('hosts', 'sockopt') + + +def downgrade() -> None: + op.add_column('hosts', sa.Column('sockopt', sa.JSON(), nullable=True)) + op.add_column('hosts', sa.Column('proxy_outbound', sa.JSON(), nullable=True)) diff --git a/app/db/models.py b/app/db/models.py index cdf4378e7..65d94bf9d 100644 --- a/app/db/models.py +++ b/app/db/models.py @@ -192,8 +192,6 @@ class ProxyHost(Base): inbound = relationship("ProxyInbound", back_populates="hosts") allowinsecure = Column(Boolean, nullable=True) is_disabled = Column(Boolean, nullable=True, default=False) - sockopt = Column(JSON, nullable=True) - proxy_outbound = Column(JSON, nullable=True) mux_enable = Column(Boolean, nullable=False, default=False, server_default='0') fragment_setting = Column(String(100), nullable=True) diff --git a/app/models/proxy.py b/app/models/proxy.py index 25922a0d4..f8c53ed7d 100644 --- a/app/models/proxy.py +++ b/app/models/proxy.py @@ -143,8 +143,6 @@ class ProxyHost(BaseModel): fingerprint: ProxyHostFingerprint = ProxyHostFingerprint.none allowinsecure: Union[bool, None] = None is_disabled: Union[bool, None] = None - sockopt: Union[dict, None] = None - proxy_outbound: Union[dict, None] = None mux_enable: Union[bool, None] = None fragment_setting: Optional[str] = Field(None, nullable=True) diff --git a/app/subscription/share.py b/app/subscription/share.py index 25b3f3dc8..3a8d6c9cc 100644 --- a/app/subscription/share.py +++ b/app/subscription/share.py @@ -326,8 +326,6 @@ def process_inbounds_and_tags( "fp": host["fingerprint"] or inbound.get("fp", ""), "ais": host["allowinsecure"] or inbound.get("allowinsecure", ""), - "sockopt": host["sockopt"], - "proxy_outbound": host["proxy_outbound"], "mux_enable": host["mux_enable"], "fragment_setting": host["fragment_setting"] } diff --git a/app/subscription/v2ray.py b/app/subscription/v2ray.py index 29b38665a..e001e9c08 100644 --- a/app/subscription/v2ray.py +++ b/app/subscription/v2ray.py @@ -209,12 +209,10 @@ def __init__(self): mux_json = json.loads(mux_template) self.mux_config = mux_json["v2ray"] - def add_outbound(self, remarks, outbound_data, proxy_outbound): + def add_outbound(self, remarks, outbound_data): json_template = json.loads(self.template) json_template["remarks"] = remarks json_template["outbounds"].insert(0, (outbound_data)) - if proxy_outbound: - json_template["outbounds"].append(proxy_outbound) self.config.insert(0, (json_template)) def render(self): @@ -581,5 +579,4 @@ def add(self, remark: str, address: str, inbound: dict, settings: dict): outbound["mux"] = self.mux_config outbound["mux"]["enabled"] = bool(inbound.get('mux_enable', False)) - self.add_outbound(remarks=remark, outbound_data=outbound, - proxy_outbound=inbound.get('proxy_outbound', '')) + self.add_outbound(remarks=remark, outbound_data=outbound) diff --git a/app/xray/__init__.py b/app/xray/__init__.py index 3f4305fcc..d4f8bb5a4 100644 --- a/app/xray/__init__.py +++ b/app/xray/__init__.py @@ -60,8 +60,6 @@ def hosts(storage: dict): if host.security == ProxyHostSecurity.inbound_default else host.security.value, "allowinsecure":host.allowinsecure, - "sockopt": host.sockopt, - "proxy_outbound": host.proxy_outbound, "mux_enable": host.mux_enable, "fragment_setting": host.fragment_setting } for host in inbound_hosts if not host.is_disabled