|
@@ -2,7 +2,6 @@ package main
|
|
|
|
|
|
import (
|
|
import (
|
|
"bytes"
|
|
"bytes"
|
|
- "crypto/rand"
|
|
|
|
"encoding/hex"
|
|
"encoding/hex"
|
|
"flag"
|
|
"flag"
|
|
"fmt"
|
|
"fmt"
|
|
@@ -101,8 +100,7 @@ type config struct {
|
|
|
|
|
|
LocalFileSystemRoot string
|
|
LocalFileSystemRoot string
|
|
|
|
|
|
- ETagEnabled bool
|
|
|
|
- ETagSignature []byte
|
|
|
|
|
|
+ ETagEnabled bool
|
|
|
|
|
|
BaseURL string
|
|
BaseURL string
|
|
}
|
|
}
|
|
@@ -124,8 +122,14 @@ var conf = config{
|
|
func init() {
|
|
func init() {
|
|
keypath := flag.String("keypath", "", "path of the file with hex-encoded key")
|
|
keypath := flag.String("keypath", "", "path of the file with hex-encoded key")
|
|
saltpath := flag.String("saltpath", "", "path of the file with hex-encoded salt")
|
|
saltpath := flag.String("saltpath", "", "path of the file with hex-encoded salt")
|
|
|
|
+ showVersion := flag.Bool("v", false, "show version")
|
|
flag.Parse()
|
|
flag.Parse()
|
|
|
|
|
|
|
|
+ if *showVersion {
|
|
|
|
+ fmt.Println(version)
|
|
|
|
+ os.Exit(0)
|
|
|
|
+ }
|
|
|
|
+
|
|
if port := os.Getenv("PORT"); len(port) > 0 {
|
|
if port := os.Getenv("PORT"); len(port) > 0 {
|
|
conf.Bind = fmt.Sprintf(":%s", port)
|
|
conf.Bind = fmt.Sprintf(":%s", port)
|
|
}
|
|
}
|
|
@@ -232,13 +236,6 @@ func init() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if conf.ETagEnabled {
|
|
|
|
- conf.ETagSignature = make([]byte, 16)
|
|
|
|
- rand.Read(conf.ETagSignature)
|
|
|
|
- log.Printf("ETag support is activated. The random value was generated to be used for ETag calculation: %s\n",
|
|
|
|
- fmt.Sprintf("%x", conf.ETagSignature))
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
initVips()
|
|
initVips()
|
|
initDownloading()
|
|
initDownloading()
|
|
}
|
|
}
|