Documentation ¶
Overview ¶
Package daemon simplifies the configuration of the aria2c daemon
Example ¶
package main import ( "fmt" "time" "github.com/oliverpool/argo" "github.com/oliverpool/argo/daemon" ) func main() { fmt.Println("Creating daemon configuration") aria2 := daemon.New() aria2.Option(daemon.Port("6801"), daemon.Secret("secretToken"), argo.Option{"max-concurrent-downloads": 1}) fmt.Println("Launching daemon (in a goroutine)") cmd := aria2.Cmd() cmd.Start() fmt.Println("Wait until the adresse is ready to listen") for !daemon.IsRunningOn(":6801") { time.Sleep(time.Second) } fmt.Println("Killing daemon (not very nice... prefer to send a aria2.shutdown command)") cmd.Process.Kill() cmd.Wait() for daemon.IsRunningOn(":6801") { time.Sleep(time.Second) } fmt.Println("Bye") }
Output: Creating daemon configuration Launching daemon (in a goroutine) Wait until the adresse is ready to listen Killing daemon (not very nice... prefer to send a aria2.shutdown command) Bye
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var EnableRPC = argo.Option{"enable-rpc": true}
EnableRPC enables JSON-RPC/XML-RPC server. It is strongly recommended to set secret authorization token using daemon.Secret option See also daemon.Port option
var ListenAll = argo.Option{"rpc-listen-all": true}
ListenAll listens incoming JSON-RPC/XML-RPC requests on all network interfaces. Default: listen only on local loopback interface (when option omitted).
Functions ¶
func AppendArg ¶
func AppendArg(args ...string) cmdOption
AppendArg creates an cmdOption to appends string to the command line.
aria2.CmdOption(daemon.AppendArg("some_raw_arg"))
func IsRunningOn ¶
IsRunningOn tests if the address is listening for TCP connections
func LogLevel ¶
LogLevel to output to console. LEVEL is either debug, info, notice, warn or error. Default: notice (when option omitted)
Types ¶
type Aria2 ¶
type Aria2 struct { Name string // contains filtered or unexported fields }
Aria2 stores the config to launch the daemon