示例#1
0
func listDirEntries(conn *wire.SyncConn, path string) (entries *DirEntries, err error) {
	if err = conn.SendOctetString("LIST"); err != nil {
		return
	}
	if err = conn.SendString(path); err != nil {
		return
	}

	return &DirEntries{scanner: conn}, nil
}
示例#2
0
func receiveFile(conn *wire.SyncConn, path string) (io.ReadCloser, error) {
	if err := conn.SendOctetString("RECV"); err != nil {
		return nil, err
	}
	if err := conn.SendString(path); err != nil {
		return nil, err
	}

	return newSyncFileReader(conn), nil
}
示例#3
0
func stat(conn *wire.SyncConn, path string) (*DirEntry, error) {
	if err := conn.SendOctetString("STAT"); err != nil {
		return nil, err
	}
	if err := conn.SendString(path); err != nil {
		return nil, err
	}

	id, err := conn.ReadOctetString()
	if err != nil {
		return nil, err
	}
	if id != "STAT" {
		return nil, util.Errorf(util.AssertionError, "expected stat ID 'STAT', but got '%s'", id)
	}

	return readStat(conn)
}