createEngine tries to the wgengine.Engine based on the order of tunnels specified in the command line flags. onlyNetstack is true if the user has explicitly requested that we use netstack for all networking.
(logf logger.Logf, sys *tsd.System)
| 708 | // onlyNetstack is true if the user has explicitly requested that we use netstack |
| 709 | // for all networking. |
| 710 | func createEngine(logf logger.Logf, sys *tsd.System) (onlyNetstack bool, err error) { |
| 711 | if args.tunname == "" { |
| 712 | return false, errors.New("no --tun value specified") |
| 713 | } |
| 714 | var errs []error |
| 715 | for _, name := range strings.Split(args.tunname, ",") { |
| 716 | logf("wgengine.NewUserspaceEngine(tun %q) ...", name) |
| 717 | onlyNetstack, err = tryEngine(logf, sys, name) |
| 718 | if err == nil { |
| 719 | return onlyNetstack, nil |
| 720 | } |
| 721 | logf("wgengine.NewUserspaceEngine(tun %q) error: %v", name, err) |
| 722 | errs = append(errs, err) |
| 723 | } |
| 724 | return false, errors.Join(errs...) |
| 725 | } |
| 726 | |
| 727 | // handleSubnetsInNetstack reports whether netstack should handle subnet routers |
| 728 | // as opposed to the OS. We do this if the OS doesn't support subnet routers |
no test coverage detected
searching dependent graphs…