1package update 2 3import ( 4 "io" 5 6 "github.com/inconshreveable/go-update/internal/binarydist" 7) 8 9// Patcher defines an interface for applying binary patches to an old item to get an updated item. 10type Patcher interface { 11 Patch(old io.Reader, new io.Writer, patch io.Reader) error 12} 13 14type patchFn func(io.Reader, io.Writer, io.Reader) error 15 16func (fn patchFn) Patch(old io.Reader, new io.Writer, patch io.Reader) error { 17 return fn(old, new, patch) 18} 19 20// NewBSDifferPatcher returns a new Patcher that applies binary patches using 21// the bsdiff algorithm. See http://www.daemonology.net/bsdiff/ 22func NewBSDiffPatcher() Patcher { 23 return patchFn(binarydist.Patch) 24} 25