Created
February 9, 2020 23:11
-
-
Save qdm12/a4dc08ffabb63386261d8240dbdb0a93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CheckTUN checks the tunnel device is present and accessible | |
func (c *configurator) CheckTUN() error { | |
c.logger.Info("%s: checking for device %s", logPrefix, constants.TunnelDevice) | |
f, err := c.openFile(string(constants.TunnelDevice), os.O_RDWR, 0) | |
if err != nil { | |
return fmt.Errorf("TUN device is not available: %w", err) | |
} | |
if err := f.Close(); err != nil { | |
c.logger.Warn("Could not close TUN device file: %s", err) | |
} | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment