mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-04-05 22:27:37 +03:00
Nits
This commit is contained in:
parent
5e8925523f
commit
f6571af24f
4 changed files with 11 additions and 11 deletions
|
@ -31,8 +31,8 @@ var (
|
|||
)
|
||||
|
||||
func PrefixWithSize(packet []byte) ([]byte, error) {
|
||||
packet_len := len(packet)
|
||||
if packet_len > 0xffff {
|
||||
packetLen := len(packet)
|
||||
if packetLen > 0xffff {
|
||||
return packet, errors.New("Packet too large")
|
||||
}
|
||||
packet = append(append(packet, 0), 0)
|
||||
|
|
|
@ -104,7 +104,7 @@ type BlockIPConfig struct {
|
|||
Format string `toml:"log_format"`
|
||||
}
|
||||
|
||||
func ConfigLoad(proxy *Proxy, svcFlag *string, config_file string) error {
|
||||
func ConfigLoad(proxy *Proxy, svcFlag *string) error {
|
||||
version := flag.Bool("version", false, "Prints current proxy version")
|
||||
configFile := flag.String("config", "dnscrypt-proxy.toml", "Path to the configuration file")
|
||||
resolve := flag.String("resolve", "", "resolve a name using system libraries")
|
||||
|
@ -237,7 +237,7 @@ func (config *Config) loadSources(proxy *Proxy) error {
|
|||
requiredProps |= ServerInformalPropertyNoFilter
|
||||
}
|
||||
for cfgSourceName, cfgSource := range config.SourcesConfig {
|
||||
if err := config.loadSource(proxy, requiredProps, &cfgSourceName, &cfgSource); err != nil {
|
||||
if err := config.loadSource(proxy, requiredProps, cfgSourceName, &cfgSource); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ func (config *Config) loadSources(proxy *Proxy) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (config *Config) loadSource(proxy *Proxy, requiredProps ServerInformalProperties, cfgSourceName *string, cfgSource *SourceConfig) error {
|
||||
func (config *Config) loadSource(proxy *Proxy, requiredProps ServerInformalProperties, cfgSourceName string, cfgSource *SourceConfig) error {
|
||||
if cfgSource.URL == "" {
|
||||
return fmt.Errorf("Missing URL for source [%s]", cfgSourceName)
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
const (
|
||||
AppVersion = "2.0.0beta12"
|
||||
ConfigFileName = "dnscrypt-proxy.toml"
|
||||
DefaultConfigFileName = "dnscrypt-proxy.toml"
|
||||
)
|
||||
|
||||
type App struct {
|
||||
|
@ -43,8 +43,8 @@ func main() {
|
|||
app.proxy = Proxy{}
|
||||
app.proxy.xTransport = NewXTransport(30 * time.Second)
|
||||
|
||||
cdFileDir(ConfigFileName)
|
||||
if err := ConfigLoad(&app.proxy, svcFlag, ConfigFileName); err != nil {
|
||||
cdFileDir(DefaultConfigFileName)
|
||||
if err := ConfigLoad(&app.proxy, svcFlag); err != nil {
|
||||
dlog.Fatal(err)
|
||||
}
|
||||
dlog.Noticef("Starting dnscrypt-proxy %s", AppVersion)
|
||||
|
|
|
@ -109,11 +109,11 @@ func (plugin *PluginCache) Eval(pluginsState *PluginsState, msg *dns.Msg) error
|
|||
if plugin.cachedResponses.cache == nil {
|
||||
return nil
|
||||
}
|
||||
cached_any, ok := plugin.cachedResponses.cache.Get(cacheKey)
|
||||
cachedAny, ok := plugin.cachedResponses.cache.Get(cacheKey)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
cached := cached_any.(CachedResponse)
|
||||
cached := cachedAny.(CachedResponse)
|
||||
if time.Now().After(cached.expiration) {
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue