cluster

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: MIT Imports: 7 Imported by: 0

README

Goal

To create bindings to allow you a go application to call Microsoft Windows Server Failover Cluster Api.

Currently uses syscall to wrap the c clusapi.dll and resutils.dll code.

Completed

Parts of the following cluster api sets

  1. Cluster
  2. Resource
  3. Registry
  4. Crypto

TODO

  • add comments for public functions
  • Write more tests
  • complete more wrappers for functions

Documentation

Index

Constants

View Source
const (
	PROV_RSA_FULL      CryptographicServiceProviderType = 1
	PROV_RSA_SIG       CryptographicServiceProviderType = 2
	PROV_DSS           CryptographicServiceProviderType = 3
	PROV_FORTEZZA      CryptographicServiceProviderType = 4
	PROV_MS_EXCHANGE   CryptographicServiceProviderType = 5
	PROV_SSL           CryptographicServiceProviderType = 6
	PROV_RSA_SCHANNEL  CryptographicServiceProviderType = 12
	PROV_DSS_DH        CryptographicServiceProviderType = 13
	PROV_EC_ECDSA_SIG  CryptographicServiceProviderType = 14
	PROV_EC_ECNRA_SIG  CryptographicServiceProviderType = 15
	PROV_EC_ECDSA_FULL CryptographicServiceProviderType = 16
	PROV_EC_ECNRA_FULL CryptographicServiceProviderType = 17
	PROV_DH_SCHANNEL   CryptographicServiceProviderType = 18
	PROV_SPYRUS_LYNKS  CryptographicServiceProviderType = 20
	PROV_RNG           CryptographicServiceProviderType = 21
	PROV_INTEL_SEC     CryptographicServiceProviderType = 22
	PROV_REPLACE_OWF   CryptographicServiceProviderType = 23
	PROV_RSA_AES       CryptographicServiceProviderType = 24

	MS_ENH_RSA_AES_PROV string = "Microsoft Enhanced RSA and AES Cryptographic Provider"

	CLUS_CREATE_CRYPT_CONTAINER_NOT_FOUND OpenClusterCryptProviderFlags = 1
	CLUS_CREATE_CRYPT_NONE                OpenClusterCryptProviderFlags = 0
)
View Source
const (
	REG_CREATED_NEW_KEY          uint32            = 0
	ERROR_NO_MORE_ITEMS          syscall.Errno     = 0x103
	CLUSREG_SET_VALUE            ClusterRegCommand = 1
	CLUSREG_CREATE_KEY           ClusterRegCommand = 2
	CLUSREG_DELETE_KEY           ClusterRegCommand = 3
	CLUSREG_DELETE_VALUE         ClusterRegCommand = 4
	CLUSREG_CONDITION_NOT_EXISTS ClusterRegCommand = 12
	CLUSREG_CONDITION_IS_EQUAL   ClusterRegCommand = 13
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterHandle

type ClusterHandle uintptr

func OpenCluster

func OpenCluster() (handle ClusterHandle, err error)

func OpenRemoteCluster

func OpenRemoteCluster(clusterName string) (handle ClusterHandle, err error)

func (ClusterHandle) Close

func (handle ClusterHandle) Close()

func (ClusterHandle) OpenResource

func (cluster ClusterHandle) OpenResource(resourceName string) (handle ResourceHandle, err error)

type ClusterRegCommand added in v0.0.3

type ClusterRegCommand uint32

type CryptographicServiceProviderType

type CryptographicServiceProviderType uint32

type HCLUSCRYPTPROVIDER

type HCLUSCRYPTPROVIDER uintptr

func OpenClusterCryptProvider

func OpenClusterCryptProvider(Resource string, Provider string, dwType CryptographicServiceProviderType, dwFlags OpenClusterCryptProviderFlags) (handle HCLUSCRYPTPROVIDER, err error)

func (HCLUSCRYPTPROVIDER) CloseClusterCryptProvider

func (handle HCLUSCRYPTPROVIDER) CloseClusterCryptProvider()

func (HCLUSCRYPTPROVIDER) ClusterDecrypt

func (handle HCLUSCRYPTPROVIDER) ClusterDecrypt(data []byte) ([]byte, error)

func (HCLUSCRYPTPROVIDER) ClusterEncrypt

func (handle HCLUSCRYPTPROVIDER) ClusterEncrypt(data []byte) ([]byte, error)

type KeyHandle

type KeyHandle uintptr

func (KeyHandle) Close

func (handle KeyHandle) Close()

func (KeyHandle) CreateBatch added in v0.0.3

func (handle KeyHandle) CreateBatch() (RegBatchHandle, error)

func (KeyHandle) CreateKey

func (handle KeyHandle) CreateKey(keyName string, samDesired int) (key KeyHandle, created bool, err error)

CreateKey creates a subkey for samDesired use syscall.KEY_ALL_ACCESS KEY_READ KEY_WRITE KEY_SET_VALUE

func (KeyHandle) DeleteValue added in v0.0.3

func (handle KeyHandle) DeleteValue(valueName string) error

DeleteValue deletes the value specified by valueName from a key

func (KeyHandle) LoadValues added in v0.0.3

func (handle KeyHandle) LoadValues() (map[string]RegistryValue, error)

LoadValues loads the values and data of a key into a map

func (KeyHandle) QueryByteValue

func (handle KeyHandle) QueryByteValue(valueName string) (data []byte, err error)

QueryByteValue returns syscall.ERROR_FILE_NOT_FOUND if value does not exist

func (KeyHandle) QueryGuidValue

func (handle KeyHandle) QueryGuidValue(valueName string) (data guid.GUID, err error)

QueryGuidValue returns syscall.ERROR_FILE_NOT_FOUND if value does not exist

func (KeyHandle) QueryValue

func (handle KeyHandle) QueryValue(valueName string) (dwType uint32, data []byte, err error)

QueryValue returns syscall.ERROR_FILE_NOT_FOUND if value does not exist for dwType either see "golang.org/x/sys/windows/registry".BINARY (and other values) or use syscall.REG_BINARY & other values

func (KeyHandle) SetByteValue

func (handle KeyHandle) SetByteValue(value string, data []byte) error

SetByteValue sets a value on a key

func (KeyHandle) SetGuidValue

func (handle KeyHandle) SetGuidValue(value string, guid guid.GUID) error

SetGuidValue sets a value on a key

func (KeyHandle) SetValue

func (handle KeyHandle) SetValue(value string, dwType uint32, data []byte) error

SetValue sets a value on a key for dwType either see "golang.org/x/sys/windows/registry".BINARY (and other values) or use syscall.REG_BINARY & other values

type OpenClusterCryptProviderFlags

type OpenClusterCryptProviderFlags uint32

type RegBatchHandle added in v0.0.3

type RegBatchHandle uintptr

func (RegBatchHandle) BatchAddCommand added in v0.0.3

func (handle RegBatchHandle) BatchAddCommand(command ClusterRegCommand, value string, dwType uint32, data []byte) error

BatchAddCommand adds a command to a batch If data is non-nil dwType should be one of the standard registry value types (REG_*) defined in golang.org/x/sys/windows/types_windows.go

func (RegBatchHandle) CloseBatch added in v0.0.3

func (handle RegBatchHandle) CloseBatch(commit bool) (error, int)

CloseBatch closes the batch, either executing or discarding it based on the value of commit The second return value is the number of the failed command It should only be used if error is not nil

type RegistryValue added in v0.0.3

type RegistryValue struct {
	Data   []byte
	DwType uint32
}

RegistryValue is a struct that contains the byte slice corresponding to a cluster registry value's data and the registry value type of the data The valid DwType options are (REG_*) defined in golang.org/x/sys/windows/types_windows.go

type ResourceHandle

type ResourceHandle uintptr

func (ResourceHandle) Close

func (handle ResourceHandle) Close()

func (ResourceHandle) GetKey

func (handle ResourceHandle) GetKey(samDesired int) (KeyHandle, error)

GetKey gets a cluster registry key for the resource for samDesired use syscall.KEY_ALL_ACCESS KEY_READ KEY_WRITE KEY_SET_VALUE

Jump to

Keyboard shortcuts

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