commons

package
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// server certificate verification modes accepted by go-irodsclient.
	// Note that go-irodsclient only verifies the server for 'hostname';
	// 'cert' behaves like 'none'.
	SSLVerifyServerNone     string = "none"
	SSLVerifyServerCert     string = "cert"
	SSLVerifyServerHostname string = "hostname"
)

Variables

This section is empty.

Functions

func GetDefaultLogPath

func GetDefaultLogPath() string

func GetReleaseVersion

func GetReleaseVersion() string

GetReleaseVersion returns release version in string

func GetVersionJSON

func GetVersionJSON() (string, error)

GetVersionJSON returns VersionInfo object in JSON string

func SetLog

func SetLog(logDir string)

Types

type Config

type Config struct {
	// for public key auth
	IRODSProxyUsername string `envconfig:"IRODS_PROXY_USER"`
	IRODSProxyPassword string `envconfig:"IRODS_PROXY_PASSWORD"`

	// for iRODS auth
	IRODSHost string `envconfig:"IRODS_HOST"`
	IRODSPort int    `envconfig:"IRODS_PORT"`
	IRODSZone string `envconfig:"IRODS_ZONE"`
	// IRODSAuthScheme should be one of ['native','pam','pam_for_users']
	IRODSAuthScheme           string `envconfig:"IRODS_AUTH_SCHEME"`
	IRODSRequireCSNegotiation bool   `envconfig:"IRODS_REQUIRE_CS_NEGOTIATION"`
	// IRODSCSNegotiationPolicy should be one of ['CS_NEG_REFUSE','CS_NEG_REQUIRE','CS_NEG_DONT_CARE']
	IRODSCSNegotiationPolicy string `envconfig:"IRODS_CS_NEGOTIATION_POLICY"`

	// for irodsfs-pool
	// IRODSPoolEndpoint is an optional irodsfs-pool service endpoint, e.g. "tcp://host:port", "unix:///path/to/socket" or "host:port"
	IRODSPoolEndpoint string `envconfig:"IRODS_POOL_ENDPOINT"`

	// for SSL/PAM auth
	IRODSSSLCACertificatePath string `envconfig:"IRODS_SSL_CA_CERT_PATH"`
	IRODSSSLAlgorithm         string `envconfig:"IRODS_SSL_ALGORITHM"`
	IRODSSSLKeySize           int    `envconfig:"IRODS_SSL_KEY_SIZE"`
	IRODSSSLSaltSize          int    `envconfig:"IRODS_SSL_SALT_SIZE"`
	IRODSSSLHashRounds        int    `envconfig:"IRODS_SSL_HASH_ROUNDS"`
	// IRODSSSLVerifyServer should be one of ['none','cert','hostname'].
	// Defaults to 'none', which does not verify the iRODS server certificate.
	IRODSSSLVerifyServer string `envconfig:"IRODS_SSL_VERIFY_SERVER"`

	// for fs mount
	IRODSShared   string `envconfig:"IRODS_SHARED"`
	SFTPGoHomeDir string `envconfig:"SFTPGO_HOME_PATH"`

	// SFTP args
	SFTPGoAuthdUsername  string `envconfig:"SFTPGO_AUTHD_USERNAME"`
	SFTPGoAuthdPassword  string `envconfig:"SFTPGO_AUTHD_PASSWORD"`
	SFTPGoAuthdPublickey string `envconfig:"SFTPGO_AUTHD_PUBLIC_KEY"`
	SFTPGoAuthdIP        string `envconfig:"SFTPGO_AUTHD_IP"`

	// SFTPGoAuthCacheTime is how long, in seconds, SFTPGo may reuse the result
	// of a successful authentication before calling this hook again. 0 falls
	// back to defaultAuthCacheTime. A revoked password or public key keeps
	// working for up to this long, so the default is deliberately short.
	SFTPGoAuthCacheTime int64 `envconfig:"SFTPGO_AUTH_CACHE_TIME"`

	// SFTPGoDeniedUsers is a comma-separated list of user names that are
	// rejected without contacting iRODS, e.g. "root,rods". Names are compared
	// case-insensitively.
	SFTPGoDeniedUsers string `envconfig:"SFTPGO_DENIED_USERS"`

	// for Logging
	SFTPGoLogDir string `envconfig:"SFTPGO_LOG_DIR"`

	// for SFTPGo REST API (folder management)
	SFTPGoAPIBaseURL string `envconfig:"SFTPGO_API_BASE_URL"`
	SFTPGoAPIKey     string `envconfig:"SFTPGO_API_KEY"`
}

Config is a configuration struct

func ReadFromEnv

func ReadFromEnv() (*Config, error)

func (*Config) GetDeniedUsers added in v0.2.5

func (config *Config) GetDeniedUsers() []string

GetDeniedUsers returns the user names listed in SFTPGO_DENIED_USERS, with surrounding spaces trimmed and empty entries dropped.

func (*Config) GetHomeDirPath added in v0.1.7

func (config *Config) GetHomeDirPath() string

GetHomeDirPath returns the user's iRODS home collection path, or an empty string for the anonymous user, who has no home collection. This is the only place the home path is spelled out, because the public key flow compares the path it derives from a home= option against this one.

func (*Config) GetSharedDirName

func (config *Config) GetSharedDirName() string

GetSharedDirName returns shared dir's name

func (*Config) HasSFTPGoAPI added in v0.2.0

func (config *Config) HasSFTPGoAPI() bool

HasSFTPGoAPI checks if SFTPGo REST API is configured

func (*Config) HasSharedDir

func (config *Config) HasSharedDir() bool

HasSharedDir checks if shared dir is provided

func (*Config) IsAnonymousUser

func (config *Config) IsAnonymousUser() bool

IsAnonymousUser checks if the user is anonymous

func (*Config) IsDeniedUser added in v0.2.5

func (config *Config) IsDeniedUser() bool

IsDeniedUser checks if the user is listed in SFTPGO_DENIED_USERS

func (*Config) IsProxyAuth added in v0.1.10

func (config *Config) IsProxyAuth() bool

IsProxyAuth checks if it uses proxy auth

func (*Config) IsPublicKeyAuth

func (config *Config) IsPublicKeyAuth() bool

IsPublicKeyAuth checks if the auth mode is public key auth

func (*Config) Validate

func (config *Config) Validate() error

Validate validates field values and returns error if occurs

func (*Config) ValidateForPublicKeyAuth

func (config *Config) ValidateForPublicKeyAuth() error

ValidateForPublicKeyAuth validates field values and returns error if occurs

type VersionInfo

type VersionInfo struct {
	ReleaseVersion string `json:"releaseVersion"`
	GitCommit      string `json:"gitCommit"`
	BuildDate      string `json:"buildDate"`
	GoVersion      string `json:"goVersion"`
	Compiler       string `json:"compiler"`
	Platform       string `json:"platform"`
}

VersionInfo object contains version related info

func GetVersion

func GetVersion() VersionInfo

GetVersion returns VersionInfo object

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址