Skip to content
/ gobits Public

Microsoft Background Intelligent Transfer Service (BITS) implementation written in Go

License

Notifications You must be signed in to change notification settings

vb4life/gobits

Repository files navigation

GoBITS

GoDoc

This repository holds my golang implementation of the BITS Upload Protocol.

It has been tested on Windows 10 and Debian 8, so it should work on all platforms.

How to get

go install gitlab.com/magan/gobits

More detail here

Configuration

More detail here

Examples

You can find an example implementation here

In short, it implements the ServeHTTP handler, so you can use it on an existing webserver written in go by simply adding the following lines of code:

import gitlab.com/magan/gobits
cb := func(event gobits.Event, session, path string) {
	switch event {
	case gobits.EventCreateSession:
		fmt.Printf("new session created: %v\n", session)
	case gobits.EventRecieveFile:
		fmt.Printf("new file created: %v\n", path)
	case gobits.EventCloseSession:
		fmt.Printf("session closed: %v\n", session)
	case gobits.EventCancelSession:
		fmt.Printf("session canceled: %v\n", session)
	}
}
bits := gobits.NewHandler(gobits.Config{}, cb)
http.Handle("/BITS/", bits)

After that, test an upload from a windows machine with the following PowerShell command:

Start-BitsTransfer -TransferType Upload -Source <path to file to upload> -Destination http://<hostname>:<port>/BITS/<filename>

About

Microsoft Background Intelligent Transfer Service (BITS) implementation written in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages