mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2024-12-29 00:30:30 +01:00
cd to the path of the executable file
This commit is contained in:
parent
2f75856983
commit
b2d297fb17
@ -3,6 +3,8 @@ package main
|
||||
import (
|
||||
"crypto/rand"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/jedisct1/dlog"
|
||||
@ -30,6 +32,7 @@ type Proxy struct {
|
||||
|
||||
func main() {
|
||||
dlog.Init("dnscrypt-proxy", dlog.SeverityNotice)
|
||||
cdLocal()
|
||||
proxy := Proxy{}
|
||||
if err := ConfigLoad(&proxy, "dnscrypt-proxy.toml"); err != nil {
|
||||
dlog.Fatal(err)
|
||||
@ -40,6 +43,16 @@ func main() {
|
||||
proxy.StartProxy()
|
||||
}
|
||||
|
||||
func cdLocal() {
|
||||
ex, err := os.Executable()
|
||||
if err != nil {
|
||||
dlog.Critical(err)
|
||||
return
|
||||
}
|
||||
exPath := filepath.Dir(ex)
|
||||
os.Chdir(exPath)
|
||||
}
|
||||
|
||||
func (proxy *Proxy) StartProxy() {
|
||||
proxy.questionSizeEstimator = NewQuestionSizeEstimator()
|
||||
if _, err := rand.Read(proxy.proxySecretKey[:]); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user