diff --git a/go.mod b/go.mod index 4f4e51fa..5a57176d 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.13 require ( github.com/kyokomi/emoji v2.1.0+incompatible - github.com/qdm12/golibs v0.0.0-20200206031633-f9e9b1bea1db + github.com/qdm12/golibs v0.0.0-20200208143139-ccf3a2b4be96 github.com/stretchr/testify v1.4.0 + golang.org/x/sys v0.0.0-20190412213103-97732733099d ) diff --git a/go.sum b/go.sum index 4ac930c9..3d77f9f2 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,8 @@ github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/qdm12/golibs v0.0.0-20200206031633-f9e9b1bea1db h1:Q3bR2GWwvDxQ0EqLKUupzHswsBsEi3eMWxAPfvzKTbM= -github.com/qdm12/golibs v0.0.0-20200206031633-f9e9b1bea1db/go.mod h1:YULaFjj6VGmhjak6f35sUWwEleHUmngN5IQ3kdvd6XE= +github.com/qdm12/golibs v0.0.0-20200208143139-ccf3a2b4be96 h1:TAhod+kjxTQHdqMNnDkg6IbLRrGovtI+3l1Isjd1wbI= +github.com/qdm12/golibs v0.0.0-20200208143139-ccf3a2b4be96/go.mod h1:YULaFjj6VGmhjak6f35sUWwEleHUmngN5IQ3kdvd6XE= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -73,6 +73,7 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= diff --git a/internal/dns/conf.go b/internal/dns/conf.go index 86a77e79..deccc36e 100644 --- a/internal/dns/conf.go +++ b/internal/dns/conf.go @@ -24,8 +24,8 @@ func (c *configurator) MakeUnboundConf(settings settings.DNS, uid, gid int) (err return c.fileManager.WriteLinesToFile( string(constants.UnboundConf), lines, - files.FileOwnership(uid, gid), - files.FilePermissions(0400)) + files.Ownership(uid, gid), + files.Permissions(0400)) } // MakeUnboundConf generates an Unbound configuration from the user provided settings diff --git a/internal/dns/roots.go b/internal/dns/roots.go index ad15a996..2697b992 100644 --- a/internal/dns/roots.go +++ b/internal/dns/roots.go @@ -18,8 +18,8 @@ func (c *configurator) DownloadRootHints(uid, gid int) error { return c.fileManager.WriteToFile( string(constants.RootHints), content, - files.FileOwnership(uid, gid), - files.FilePermissions(0400)) + files.Ownership(uid, gid), + files.Permissions(0400)) } func (c *configurator) DownloadRootKey(uid, gid int) error { @@ -33,6 +33,6 @@ func (c *configurator) DownloadRootKey(uid, gid int) error { return c.fileManager.WriteToFile( string(constants.RootKey), content, - files.FileOwnership(uid, gid), - files.FilePermissions(0400)) + files.Ownership(uid, gid), + files.Permissions(0400)) } diff --git a/internal/openvpn/auth.go b/internal/openvpn/auth.go index 0e022f2d..b4a61e21 100644 --- a/internal/openvpn/auth.go +++ b/internal/openvpn/auth.go @@ -18,6 +18,6 @@ func (c *configurator) WriteAuthFile(user, password string, uid, gid int) error return c.fileManager.WriteLinesToFile( string(constants.OpenVPNAuthConf), []string{user, password}, - files.FileOwnership(uid, gid), - files.FilePermissions(0400)) + files.Ownership(uid, gid), + files.Permissions(0400)) } diff --git a/internal/pia/conf.go b/internal/pia/conf.go index 28bc8358..a0ee6f09 100644 --- a/internal/pia/conf.go +++ b/internal/pia/conf.go @@ -81,6 +81,6 @@ func (c *configurator) BuildConf(region models.PIARegion, protocol models.Networ "", "", }...) - err = c.fileManager.WriteLinesToFile(string(constants.OpenVPNConf), lines, files.FileOwnership(uid, gid), files.FilePermissions(0400)) + err = c.fileManager.WriteLinesToFile(string(constants.OpenVPNConf), lines, files.Ownership(uid, gid), files.Permissions(0400)) return IPs, port, err } diff --git a/internal/shadowsocks/conf.go b/internal/shadowsocks/conf.go index f8e3b107..d59a6f48 100644 --- a/internal/shadowsocks/conf.go +++ b/internal/shadowsocks/conf.go @@ -14,8 +14,8 @@ func (c *configurator) MakeConf(port uint16, password string, uid, gid int) (err return c.fileManager.WriteToFile( string(constants.ShadowsocksConf), data, - files.FileOwnership(uid, gid), - files.FilePermissions(0400)) + files.Ownership(uid, gid), + files.Permissions(0400)) } func generateConf(port uint16, password string) (data []byte) { diff --git a/internal/tinyproxy/conf.go b/internal/tinyproxy/conf.go index d1ae854b..963a3b3f 100644 --- a/internal/tinyproxy/conf.go +++ b/internal/tinyproxy/conf.go @@ -14,8 +14,8 @@ func (c *configurator) MakeConf(logLevel models.TinyProxyLogLevel, port uint16, lines := generateConf(logLevel, port, user, password) return c.fileManager.WriteLinesToFile(string(constants.TinyProxyConf), lines, - files.FileOwnership(uid, gid), - files.FilePermissions(0400)) + files.Ownership(uid, gid), + files.Permissions(0400)) } func generateConf(logLevel models.TinyProxyLogLevel, port uint16, user, password string) (lines []string) {