fatedier / frp

A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
Apache License 2.0
86.43k stars 13.37k forks source link

[Feature Request] Stop the client or server gracefully #2670

Closed hinupurthakur closed 1 year ago

hinupurthakur commented 2 years ago

Describe the feature request

Currently we don't have a command that can stop the frp client (or server) gracefully on a machine

Describe alternatives you've considered

we should have a command like frpc stop (or frps stop) to stop the active connections gracefully.

Please let me know if this is something we would like to have as a feature, I can help to contribute as well.

Thanks

Affected area

fatedier commented 2 years ago

I'm not sure if it's necessary.

Can you describe more about your use case and how to decide when frp service can stop?

Lots of people use frp as port forwarder and their connections will keep alive for a long time.

hinupurthakur commented 2 years ago

@fatedier Thanks for the response. I am using it with the application for the http proxy. Once I close the application, I want the frpc to stop (not the server, in my case). Currently I am doing it by the process ID but if we can have an option like frpc stop but only if this use case is not too specific for my use. Thank You!

fatedier commented 2 years ago

I think it's ok to support graceful shudown only on frpc.

We can add a new api like /api/stop and frpc stop --grace-period=10 will call this api.

PRs on this feature are welcome.

hinupurthakur commented 2 years ago

If nobody have yet taken this issue up, I will be happy to work on it.