wireformat.go 825 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package protocol
  2. import (
  3. "path/filepath"
  4. "code.google.com/p/go.text/unicode/norm"
  5. )
  6. type wireFormatConnection struct {
  7. next Connection
  8. }
  9. func (c wireFormatConnection) ID() string {
  10. return c.next.ID()
  11. }
  12. func (c wireFormatConnection) Index(node string, fs []FileInfo) {
  13. var myFs = make([]FileInfo, len(fs))
  14. copy(myFs, fs)
  15. for i := range fs {
  16. myFs[i].Name = norm.NFC.String(filepath.ToSlash(myFs[i].Name))
  17. }
  18. c.next.Index(node, myFs)
  19. }
  20. func (c wireFormatConnection) Request(repo, name string, offset int64, size int) ([]byte, error) {
  21. name = norm.NFC.String(filepath.ToSlash(name))
  22. return c.next.Request(repo, name, offset, size)
  23. }
  24. func (c wireFormatConnection) Statistics() Statistics {
  25. return c.next.Statistics()
  26. }
  27. func (c wireFormatConnection) Option(key string) string {
  28. return c.next.Option(key)
  29. }