-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage as a library #44
Comments
You probably want to use Actually, you don't even need a When you omit the need for multiple servers and clients and routing rules, the initialization process is actually not that complex, and should be easy to implement in your own code. You could do something like: cc := ClientConfig{
Name: "direct",
Protocol: "direct",
EnableTCP: true,
DialerTFO: true,
EnableUDP: true,
MTU: 1500,
}
err := cc.Initialize(nil, nil, logger)
// error handling
tcpClient, err := cc.TCPClient()
// error handling
udpClient, err := cc.UDPClient()
// error handling
router, err := router.Config{}.Router(logger, nil, nil, map[string]zerocopy.TCPClient{"direct": tcpClient}, map[string]zerocopy.UDPClient{"direct": udpClient}, nil)
// error handling
// Then you copy the logic you need from service/server.go |
I guess that will work, buy anyway, I would prefer not to touch internals and have some high-level API for all those initialization/creation things. server := Config{}
server.Start(ctx)
...
server.UserAdd("foo", key)
server.UserRemove("foo")
...
server.Stop() |
What you are proposing might look nice at first glance, but it's going to create a lot of mess when you start implementing it. It's fundamentally incompatible with shadowsocks-go's architecture. The relay services ( |
Discussion thread of #43
The use case as simple as possible: an ability to create and manager a single server without external HTTP API.
Server configuration example:
Now we need an ability to add/remove/list users of that server via
Manager
.The text was updated successfully, but these errors were encountered: