Highly-opinionated (ex-bullshit-free) MTPROTO proxy for Telegram. If you use v1.0 or upgrade broke you proxy, please read the chapter Version 2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324
  1. //go:build windows
  2. // +build windows
  3. package utils
  4. import (
  5. "context"
  6. "os"
  7. "os/signal"
  8. )
  9. func RootContext() context.Context {
  10. ctx, cancel := context.WithCancel(context.Background())
  11. sigChan := make(chan os.Signal, 1)
  12. signal.Notify(sigChan, os.Interrupt)
  13. go func() {
  14. for range sigChan {
  15. cancel()
  16. }
  17. }()
  18. return ctx
  19. }