GBClientNetworkTools

package
v0.0.0-...-3040e0b Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2015 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FILE_ADDED_CONST = iota
	FILE_MODIFIED_CONST
	FILE_DELETED_CONST
	ERR_CONST
	EOF_CONST
	PING_CONST
	DISCONNECT_CONST

	PING = "." // Sent when pinging the server.
)

Variables

View Source
var (
	// Files_to_ignore_mac lists that files with the following substrings should be ignored.
	Files_to_ignore_mac []string = []string{".DS_Store", ".sb-", ".function.m.swp", ".localized"}
)

Functions

func CheckToIgnore

func CheckToIgnore(filePath string) bool

CheckToIgnore checks if the given file should be sent to the Gopherbox filesystem. Currently only works with Mac files that should be ignored.

func ClientReceiveSessionInformation

func ClientReceiveSessionInformation(tlsConn *tls.Conn, keyfile_path string) (key []byte, last_accessed int64, err error)

func GetValueFromContentsBlock

func GetValueFromContentsBlock(tlsConn *tls.Conn) (contents_type string, contents string, n int, err error)

GetValueFromContentsBlock returns the contents type in the header, as well as the contents contained within.

func SendDataEncrypted

func SendDataEncrypted(tlsConn *tls.Conn, file GBClientWatch.OutputData, operation_const int, private_key []byte) error

SendData sends the conn the metadata and encrypted contents of the file, according to the Gopherbox file transfer scheme.

func SendMetadata

func SendMetadata(conn *tls.Conn, file GBClientWatch.OutputData, operation_const int, truncated bool) error

SendMetadata sends the file metadata to the connection, with a truncated or non-truncated path.

func WriteContentsToConn

func WriteContentsToConn(conn *tls.Conn, content_type string, contents string) (int, error)

WriteContentsToConn writes contents to the server in block format, with the content_type header.

Types

type FileMetadata

type FileMetadata struct {
	Path              string `bson: "path"`
	Is_dir            bool   `bson: "is_dir"`
	Modification_time int64  `bson: "modification_time"`
	Size              int64  `bson: "size"`
}

FileMetadata stores the metadata for each file.

func ReadDataEncrypted

func ReadDataEncrypted(tlsConn *tls.Conn, private_key []byte) (metadata FileMetadata, contents string, operation_int int, err error)

Jump to

Keyboard shortcuts

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