Bindings (read-only for now) for the libsmbclient library from samba. To compile on debian/ubuntu install the "libsmbclient-dev" package.
Build it with:
$ go build ./cmd/smb
$ ./smb -show-dir smb://localhost
Check main.go for a code example.
The C libsmbclient from samba is not thread safe, so all go smbclient.Client/smbclient.File operations are serialized (i.e. there can only be one operation at a time for each Client/File). As a workaround you should create one smbclient.Client per goroutine.
import (
"fmt"
"github.com/mvo5/libsmbclient-go"
)
client := smbclient.New()
dh, err := client.Opendir("smb://localhost")
if err != nil {
return err
}
defer dh.Closedir()
for {
dirent, err := dh.Readdir()
if err != nil {
break
}
fmt.Println(dirent)
}