Skip to content

Commit

Permalink
drop proxy_outbound and sockopt from hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintShit committed Feb 28, 2024
1 parent cdd87e1 commit d01cbd0
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 15 deletions.
2 changes: 0 additions & 2 deletions app/db/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
Expand Down
Original file line number Diff line number Diff line change
@@ -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))
2 changes: 0 additions & 2 deletions app/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 0 additions & 2 deletions app/models/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 0 additions & 2 deletions app/subscription/share.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
Expand Down
7 changes: 2 additions & 5 deletions app/subscription/v2ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
2 changes: 0 additions & 2 deletions app/xray/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d01cbd0

Please sign in to comment.