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
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

root_context_windows.go 335B

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. }