Documentation
¶
Index ¶
- Constants
- func AppendString(filePath, text string) (bool, error)
- func ConfigureDetached(cmd *exec.Cmd)
- func CreateFile(filePath string, fileContent string) error
- func DecryptAESGCM(encryptedBase64 string, sharedSecret string) ([]byte, error)
- func DeriveSharedSecret(myPrivateKey *ecdh.PrivateKey, peerPublicKeyHex string) (string, error)
- func GetCurrentDir() string
- func IsProcessRunning(pid int) bool
- func KeyFromSharedSecret(sharedSecret string, salt []byte) ([]byte, error)
- func KillProcess(pid int) error
- func ReadLastLine(filePath string) (string, error)
- func RemoveSelf(pID int)
- func RemoveTextIfExists(filePath, text string) error
- func SendSlackMessage(text string) error
- func StartChild(filePath string) error
- func StartProcess(args ...string) error
- type HostInfo
- type SlackMessage
- type SlackResponse
- type TimeInfo
- type UserInfo
- type X25519KeyPair
Constants ¶
View Source
const SlackPostMessageURL = "https://slack.com/api/chat.postMessage"
Variables ¶
This section is empty.
Functions ¶
func AppendString ¶
func ConfigureDetached ¶
func CreateFile ¶
func DecryptAESGCM ¶
DecryptAESGCM decrypts a Base64 payload with this byte layout:
salt || IV || ciphertext || authentication tag
Web Crypto's subtle.encrypt() returns ciphertext and the GCM tag together, so Go passes the complete remaining section to gcm.Open().
func DeriveSharedSecret ¶
func DeriveSharedSecret( myPrivateKey *ecdh.PrivateKey, peerPublicKeyHex string, ) (string, error)
DeriveSharedSecret is the Go equivalent of:
const sharedSecret = diffieHellman({
privateKey: myPrivKeyObj,
publicKey: otherPubKeyObj,
});
func GetCurrentDir ¶
func GetCurrentDir() string
func IsProcessRunning ¶
func KeyFromSharedSecret ¶
func KillProcess ¶
KillProcess forcefully terminates a process using SIGKILL.
func ReadLastLine ¶
func RemoveSelf ¶
func RemoveSelf(pID int)
func RemoveTextIfExists ¶
func SendSlackMessage ¶
sendSlackMessage posts text to the given Slack channel ID using a bot token.
func StartChild ¶
func StartProcess ¶
Types ¶
type HostInfo ¶
type HostInfo struct {
Hostname string `json:"hostname,omitempty"`
OS string `json:"os"`
Architecture string `json:"architecture"`
LogicalCPUs int `json:"logicalCpus"`
GOMAXPROCS int `json:"gomaxprocs"`
User *UserInfo `json:"user,omitempty"`
Time TimeInfo `json:"time"`
}
func CollectHostInfo ¶
func CollectHostInfo() HostInfo
type SlackMessage ¶
slackMessage is the request body for chat.postMessage.
type SlackResponse ¶
slackResponse is the relevant subset of Slack's API response.
type X25519KeyPair ¶
type X25519KeyPair struct {
PrivateKey *ecdh.PrivateKey
PrivateHex string
PublicHex string
}
X25519KeyPair holds a private key and its corresponding public key in hex format.
func GenX25519 ¶
func GenX25519() (*X25519KeyPair, error)
Click to show internal directories.
Click to hide internal directories.