network_detection.go 710 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * @Author: LinkLeong a624669980@163.com
  3. * @Date: 2022-05-08 14:58:46
  4. * @LastEditors: LinkLeong a624669980@163.com
  5. * @LastEditTime: 2022-05-09 13:42:26
  6. * @FilePath: /CasaOS/pkg/utils/network_detection.go
  7. * @Description:
  8. *
  9. * Copyright (c) 2022 by LinkLeong a624669980@163.com, All Rights Reserved.
  10. */
  11. package utils
  12. import natType "github.com/Curtis-Milo/nat-type-identifier-go"
  13. /**
  14. * @description:
  15. * @param {chanstring} data
  16. * @param {string} url
  17. * @return {*}
  18. */
  19. func GetNetWorkTypeDetection(data chan string, url string) {
  20. // fmt.Println("url:", url)
  21. // httper.Get(url, nil)
  22. // aaa <- url
  23. result, err := natType.GetDeterminedNatType(true, 5, url)
  24. if err == nil {
  25. data <- result
  26. }
  27. }