Documentation
¶
Index ¶
- Constants
- func CleanUserEnvironmentVariable(name string, wslenv bool) error
- func CygwinCreateSocketFile(fname string, port int) (nonce [16]byte, err error)
- func CygwinNonceString(nonce [16]byte) string
- func CygwinPerformHandshake(conn io.ReadWriter, nonce [16]byte) error
- func FileExists(filename string) bool
- func GetIntOption(name string, def uint64) uint64
- func IsNetClosing(err error) bool
- func IsProperWindowsVer() (bool, error)
- func KillRunningAgent() error
- func MessageBox(title, text string, style uintptr) int
- func NewLogWriter(title string, flags int, debug bool)
- func PrepareUserEnvironmentVariable(name, value string, wslenv, translate bool) error
- func PrepareWindowsPath(path string) string
- func PromptForConfirmaion(_ DlgDetails, description, prompt string, onebutton bool) bool
- func PromptForWindowsCredentials(details DlgDetails, errorMessage, description, prompt string, save bool) (bool, string, bool)
- func SetIntOption(name string, val uint64)
- func ShowOKMessage(t MsgType, title, text string)
- func WaitForFileArrival(period time.Duration, filenames ...string) bool
- func WaitForFileDeparture(period time.Duration, filenames ...string)
- func XAgentCookieString(n int) string
- func XAgentPerformHandshake(conn io.ReadWriter, cookie string) error
- type DlgDetails
- type MsgType
- type XAgentAdvertiser
Constants ¶
const ( CREDUI_MAX_CAPTION_LENGTH = 128 CREDUI_MAX_MESSAGE_LENGTH = 32767 CREDUI_MAX_USERNAME_LENGTH = 256 CREDUI_MAX_PASSWORD_LENGTH = 256 CREDUI_MAX_GENERIC_TARGET_LENGTH = 32767 CREDUI_MAX_DOMAIN_TARGET_LENGTH = 256 + 1 + 80 CREDUIWIN_GENERIC = 0x1 // Return the user name and password in plain text. CREDUIWIN_CHECKBOX = 0x2 // The Save check box is displayed in the dialog box. CREDUIWIN_IN_CRED_ONLY = 0x20 // Only the credentials specified by the pvInAuthBuffer parameter )
const ( // How it will look. MB_OK = 0x00000000 MB_OKCANCEL = 0x00000001 MB_ABORTRETRYIGNORE = 0x00000002 MB_YESNOCANCEL = 0x00000003 MB_YESNO = 0x00000004 MB_RETRYCANCEL = 0x00000005 MB_CANCELTRYCONTINUE = 0x00000006 MB_ICONHAND = 0x00000010 MB_ICONQUESTION = 0x00000020 MB_ICONEXCLAMATION = 0x00000030 MB_ICONASTERISK = 0x00000040 MB_USERICON = 0x00000080 MB_ICONWARNING = MB_ICONEXCLAMATION MB_ICONERROR = MB_ICONHAND MB_ICONINFORMATION = MB_ICONASTERISK MB_ICONSTOP = MB_ICONHAND // And behave. MB_DEFBUTTON1 = 0x00000000 MB_DEFBUTTON2 = 0x00000100 MB_DEFBUTTON3 = 0x00000200 MB_DEFBUTTON4 = 0x00000300 MB_SETFOREGROUND = 0x00010000 // Return values. IDOK = 1 IDCANCEL = 2 IDABORT = 3 IDRETRY = 4 IDIGNORE = 5 IDYES = 6 IDNO = 7 )
Windows SDK constants.
const ( SSHAgentPipeName = "\\\\.\\pipe\\openssh-ssh-agent" MaxNameLen = windows.UNIX_PATH_MAX // openssh-portable has it at 256 * 1024. // gpg-agent is using 16 * 1024. // Putty seems to have it at 8 + 1024. MaxAgentMsgLen = 256 * 1024 GPGAgentName = "gpg-agent" WinAgentName = "agent-gui" SocketAgentName = "S." + GPGAgentName SocketAgentBrowserName = "S." + GPGAgentName + ".browser" SocketAgentExtraName = "S." + GPGAgentName + ".extra" SocketAgentSSHName = "S." + GPGAgentName + ".ssh" SocketAgentSSHCygwinName = "S." + GPGAgentName + ".ssh.cyg" )
Shared names.
Variables ¶
This section is empty.
Functions ¶
func CleanUserEnvironmentVariable ¶
CleanUserEnvironmentVariable will reverse settings done by PrepareUserEnvironmentVariable.
func CygwinCreateSocketFile ¶ added in v1.2.0
CygwinCreateSocketFile creates CygWin socket file with proper content and attributes.
func CygwinNonceString ¶ added in v1.2.0
CygwinNonceString converts binary nonce to printable string in net order.
func CygwinPerformHandshake ¶ added in v1.2.0
func CygwinPerformHandshake(conn io.ReadWriter, nonce [16]byte) error
CygwinPerformHandshake exchanges handshake data.
func GetIntOption ¶ added in v1.6.0
GetIntOption reads named integer value from registry. If value does not exist or there is a problem - default is returned.
func IsNetClosing ¶
IsNetClosing exists because ErrNetClosing is not exported. This is probably going to change in 1.16.
func IsProperWindowsVer ¶ added in v1.3.1
IsProperWindowsVer checks if program is running on supported WIndows.
func KillRunningAgent ¶
func KillRunningAgent() error
KillRunningAgent uses Os functions to terminate gpg-agent ungracefully.
func MessageBox ¶ added in v1.3.1
MessageBox full native implementation.
func NewLogWriter ¶ added in v1.3.1
NewLogWriter redirects all log output depending on debug parameetr. When true all output goes to OutputDebugString and you could use debugger or Sysinternals dbgview.exe to collect it. When false - everything is discarded.
func PrepareUserEnvironmentVariable ¶
PrepareUserEnvironmentVariable modifies user environment. if wslenv is true - its name is added to WSLENV/up list for path translation.
func PrepareWindowsPath ¶
PrepareWindowsPath prepares Windows path for use on unix shell line without quoting.
func PromptForConfirmaion ¶ added in v1.3.1
func PromptForConfirmaion(_ DlgDetails, description, prompt string, onebutton bool) bool
func PromptForWindowsCredentials ¶ added in v1.3.1
func PromptForWindowsCredentials(details DlgDetails, errorMessage, description, prompt string, save bool) (bool, string, bool)
PromptForWindowsCredentials calls Windows CredUI.dll to pupup "standard" Windows security dialog using provided description, prompt and a flag, indicating that user could make a choice to save the result in Windows Credential manager. It returns canceled flag (indicating error or user's refusal to complete operation) and when false string with entered password/pin and flag indicating that user checked "Remember me" checkbox.
func SetIntOption ¶ added in v1.6.0
SetIntOption stores named integer value to registry. Key must exist. Errors are ignored.
func ShowOKMessage ¶ added in v1.3.1
ShowOKMessage shows simple MB_OK message box.
func WaitForFileArrival ¶
WaitForFileArrival checks for files existence once a second for requested waiting period.
func WaitForFileDeparture ¶
WaitForFileDeparture attempts to remove files once a second for requested waiting period.
func XAgentCookieString ¶ added in v1.5.0
func XAgentPerformHandshake ¶ added in v1.5.0
func XAgentPerformHandshake(conn io.ReadWriter, cookie string) error
XAgentPerformHandshake exchanges handshake data with client.
Types ¶
type DlgDetails ¶ added in v1.3.1
type MsgType ¶ added in v1.3.1
type MsgType uint32
MsgType specifies how message box will look and behave.
const ( MsgError MsgType = MB_ICONHAND MsgExclamation MsgType = MB_ICONEXCLAMATION MsgInformation MsgType = MB_ICONASTERISK )
Actual values.
type XAgentAdvertiser ¶ added in v1.5.0
type XAgentAdvertiser struct {
// contains filtered or unexported fields
}
func AdvertiseXAgent ¶ added in v1.5.0
func AdvertiseXAgent(cookie string, port int) (xa *XAgentAdvertiser, err error)
AdvertiseXAgent() sets up server side part of XAgent protocol.
func (*XAgentAdvertiser) Close ¶ added in v1.5.0
func (xa *XAgentAdvertiser) Close() error
Close implements io.Closer.