diff --git a/README.md b/README.md index 4245356..e1c6315 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,10 @@ Inspired by [mtprotoproxy](https://github.com/alexbers/mtprotoproxy) ## Building ## -You will most likely need `go 1.21` +You will most likely need `go 1.23` ```shell go mod download - go build ./cmd/tgp ``` diff --git a/go.mod b/go.mod index 194ffb1..0543207 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/geovex/tgp -go 1.21 +go 1.23 require ( github.com/BurntSushi/toml v1.3.2 diff --git a/internal/config/config.go b/internal/config/config.go index 72c01b5..b6a4387 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -111,15 +111,14 @@ func (c *Config) GetUserSecret(user string) (string, error) { } } -func (c *Config) IterateUsers() chan *User { - result := make(chan *User) - go func() { - defer close(result) +func (c *Config) IterateUsers() func(func(*User) bool) { + return func(fn func(*User) bool) { for _, u := range c.users.Users { - result <- u + if fn(u) { + return + } } - }() - return result + } } func (c *Config) GetDefaultSocks() (url, user, pass *string) {