MetaCubeX / mihomo

A simple Python Pydantic model for Honkai: Star Rail parsed data from the Mihomo API.
https://wiki.metacubex.one
MIT License
15.62k stars 2.56k forks source link

[Feature] Create redirect proxy type to overwrite the current server proxy #1243

Closed ocixe closed 3 months ago

ocixe commented 4 months ago

Verify steps

Description

I live in some planet which depends on cloudflare IP, they only give me access to specific IP, the IP is not persistent, always change some time.

As example today is ip 1.2.3.4 next 30 day is 2.3.4.5 or 5.6.7.8

In order to use vmess or trojan I must change IP by edit proxy provider file.

Not only me but 10k+ people in my planet maybe have same problem.

I'm already use proxy type http, unfortunatelly only available CONNECT method by default.

What I want to request is create a new proxy type redirect, the main function is replace server and port, or maybe sni.

proxies:
  # redirect
  - name: "SERVER1"
    type: redirect
    server: 1.2.3.4
    port: 443
    # tls: true # https
    # skip-cert-verify: true
    # sni: custom.com
  - name: "SS1"
    type: ss
    server: unusedserverbecause_will_overwrite by dialer
    port: unused_port_because_will_overwrite by dialer
    dialer-proxy: SERVER1

something like that. how I can achieve ?

i want build my self but im really zero golang. maybe someone give me clue how to do it ( create myself proxies type then build it ) i will do it with copilot.

Possible Solution

No response

c83a commented 4 months ago

Have you ever looked at 'tunnel' ? https://wiki.metacubex.one/en/config/tunnels/ Sounds like work for u?

ocixe commented 4 months ago

Have you ever looked at 'tunnel' ? https://wiki.metacubex.one/en/config/tunnels/ Sounds like work for u?

It seems just make a forwarding with proxy to new localhost port.

From facebook group discussion I discovered this.

server:
 - &address1 myserver.com
 - &address2 1.2.3.4

ws: &ws
    port: 443
    type: trojan
    password: premium
    network: ws
    skip-cert-verify: true
    udp: true
    sni: nasa.gov
    ws-opts:
      path: /trojan
      headers:
        Host: nasa.gov
proxies:
#formatws
  - name: *address1 
    server: *address1 
    <<: *ws
  - name: *address2
    server: *address2
    <<: *ws

Maybe this is what I want, I need read more from this doc https://wiki.metacubex.one/en/config/syntax/#references

That file will provide one proxy group, I need help for working like this.

Proxy Groups [ GATEWAY ] : [ 1.1.1.1 ] [ 2.2.2.2 ] [ 3.3.3.3 ] Proxy Groups [ PROXY ] : [ myserver-a.com ] [ myserver-b.com ] [ myserver-c.com ]

When select [ 2.2.2.2 ] in [ GATEWAY ], all connection in the [ PROXY ] ( I mean overide server ) should use from gateway.

ocixe commented 3 months ago

https://github.com/MetaCubeX/mihomo/blob/a9ecc627e6376bcb75d2dfc9ca20008e8c794f7b/docs/config.yaml#L910

I was wondering also there support for override server port etc, seems key is hardcoded, why not if in the current proxy provider has key match in override section then override it, else ignore, would be great if can set like that. Thankyou.

override: # 覆写节点加载时的一些配置项
      skip-cert-verify: true
      udp: true
xishang0128 commented 3 months ago

@lexavey Not supported

Replacing non-generic items such as server is inappropriate behavior.

xishang0128 commented 3 months ago

@lexavey If you need to change the IP for specific servers, please use the hosts.