Skip to content

请问如果要实现多条转发配置应该是如何操作 #2

Closed

Description

@tuboshu66

我想到的是可以通过systemd来管理每一个进程
请勿后续是否考虑增加配置文件支持?

Activity

  1. zanjie1999 commented on Oct 28, 2021

    @zanjie1999
    Owner

    启动多个进程即可
    systemd这种需要修改系统的事情是绝对不会做的
    配置文件嘛,启动命令直接写到rc.local不是更方便吗,大概不会做

  2. tuboshu66 commented on Oct 28, 2021

    @tuboshu66
    Author

    非常感谢您的回复,写到rc.local确实方便。但是如果有多个转发路径,比如>20条就有一点点难受了。通过systemd则需要每条规则设置一个,直接&后台运行不方便管理。

    我尝试像这样写下文件,然后让systemd启动,但是始终感觉不是最优解
    tcp2ws ws://1.1.1.1:2345 88 &
    tcp2ws ws://1.1.1.1:3456 888 &
    tcp2ws ws://1.1.1.1:4567 8888 &

    请问是否考虑对多线路转发做一些调整

  3. zanjie1999 commented on Oct 28, 2021

    @zanjie1999
    Owner

    为什么会有那么多啊(

  4. tuboshu66 commented on Oct 28, 2021

    @tuboshu66
    Author

    因为业务需要。。。实际上可能会超过100个,不过我使用上面那种方案(systemd运行后台程序基本可以解决我的需求了

    但是如果程序原生支持config就更完美了,可以 tcp2ws -c config 了。。。

  5. zanjie1999 commented on Oct 28, 2021

    @zanjie1999
    Owner

    机场主吗(
    哪天闲下来可以做,看着源码想了一下是可以实现一个进程来转发所有的
    目前在很烂的网也能跑的挺稳,所以懒得改
    另外可以ps -ef | grep 端口号去快速的找到你需要关掉的那个
    killall可以帮你全部关掉

  6. tuboshu66 commented on Oct 28, 2021

    @tuboshu66
    Author

    是的
    非常非常感谢,我现在也是使用 killall tcp2ws 关掉所有
    我现在使用systemd启动

    ExecStart=/usr/local/tcp2ws/config.conf
    ExecStop=/usr/bin/killall tcp2ws
    

    然后在config.conf写入

    #!/bin/bash
    tcp2ws ws://1.1.1.1:2345 88 &
    tcp2ws ws://1.1.1.1:3456 888 &
    tcp2ws ws://1.1.1.1:4567 8888 &
    

    基本可以实现我设想的功能,不过非常非常期待您的新版本能够支持

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions