Skip to content

Instantly share code, notes, and snippets.

@AlecTaylor
Created April 30, 2015 05:02
Show Gist options
  • Save AlecTaylor/06d07e485fa1bca2f740 to your computer and use it in GitHub Desktop.
Save AlecTaylor/06d07e485fa1bca2f740 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os"
"strconv"
)
func environGet(key string, otherwise string) int {
v := os.Getenv(key)
if v == "" {
v = otherwise
}
return strconv.Itoa(v)
}
const (
DEFAULT_TIMEOUT = environGet("DEFAULT_TIMEOUT", "30000") // default timeout for operations (in milliseconds)
CHUNK_SIZE = environGet("CHUNK_SIZE", "65536") // chunk size in bytes for scp
THROUGHPUT_SLEEP_INTERVAL = environGet("THROUGHPUT_SLEEP_INTERVAL", "100") // how many milliseconds to sleep between writing "tickets" to channel in maxThroughputThread
MIN_CHUNKS = environGet("MIN_CHUNKS", "10") // minimum allowed count of chunks to be sent per sleep interval
MIN_THROUGHPUT = environGet("MIN_THROUGHPUT", CHUNK_SIZE*MIN_CHUNKS*(1000/THROUGHPUT_SLEEP_INTERVAL))
MAX_OPENSSH_AGENT_CONNECTIONS = environGet("MAX_OPENSSH_AGENT_CONNECTIONS", 128) // default connection backlog for openssh
)
func main() {
fmt.PrintLn(DEFAULT_TIMEOUT)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment