package args import ( "io/fs" ) type Args struct { Version bool `short:"v" long:"version" description:"Print the version and exit."` DetailVersion bool `short:"V" long:"detail" description:"Print detailed version info and exit."` DoDebug bool `env:"CINFO_DEBUG" short:"d" long:"debug" description:"If specified, enable debug logging. This may log a LOT of information."` SockMode fs.FileMode `env:"CINFO_FMODE" short:"m" long:"fmode" default:"0o0600" description:"If using a UDS, set the socket file to this permission. This should probably be either 0o0600 or 0o0660."` SockDirMode fs.FileMode `env:"CINFO_DMODE" short:"M" long:"dmode" default:"0o0700" description:"If using a UDS, attempt to set the directory containing the socket to use this permission. This should probably be either 0o0700 or 0o0770."` SockGrp *string `env:"CINFO_FGRP" short:"g" long:"fgroup" description:"If specified and using a UDS, attempt to set the socket to this GID/group name. (If unspecified, the default is current user's primary group.)"` SockDirGrp *string `env:"CINFO_DGRP" short:"G" long:"dgroup" description:"If specified and using a UDS, attempt to set the directory containing the socket to this GID/group name. (If unspecified, the default is current user's primary group.)"` V4Url *string `env:"CINFO_V4U" short:"4" long:"ipv4" description:"If specified, IPv6 clients can have their IPv4 address detected by using this URL (e.g. 'https://c4.r00t2.io/').\nIt is expected that this URL is also serving ClientInfo." validate:"omitempty,url"` V6Url *string `env:"CINFO_V6U" short:"6" long:"ipv6" description:"If specified, IPv4 clients can have their IPv6 address detected by using this URL (e.g. 'https://c6.r00t2.io/').\nIt is expected that this URL is also serving ClientInfo." validate:"omitempty,url"` CORS []string `env:"CINFO_CORS" short:"c" long:"cors" description:"Specify additional/explicit CORS origin(s). If you're using -4/--ipv4 and/or -6/--ipv6, they will be added automatically but you should add any dual-stack domains that serve ClientInfo here (e.g. '--cors https://r00t2.io'"` Listen ListenArgs `positional-args:"true"` } type ListenArgs struct { Listen string `env:"CINFO_URI" positional-arg-name:"LISTEN_URI" default:"unix:///var/run/clientinfo/fcgi.sock" description:"The specification to listen on.\nIf the scheme is 'unix', a FastCGI UDS/IPC socket is used (default); any host, query parameters, etc. component is ignored and the URI path is used to specify the socket.\nIf 'tcp', a FastCGI socket over TCP is opened on the .\nIf 'http', an HTTP listener is opened on the ; any path, query parameters, etc. components are ignored.\nHTTPS is unsupported; terminate with a reverse proxy. All other schemes will cause a fatal error." validate:"required,uri"` } type UdsPerms struct { UID int FGID int DGID int FMode fs.FileMode DMode fs.FileMode }