2015-04-14 03:14:38 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"net/textproto"
|
2015-04-14 18:43:09 +03:00
|
|
|
|
|
|
|
"github.com/ncw/swift"
|
2015-04-14 03:14:38 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
type Conn struct {
|
2015-04-15 14:57:47 +03:00
|
|
|
ctrl *textproto.Conn
|
2015-04-30 16:54:17 +03:00
|
|
|
data net.Conn
|
2015-04-15 14:57:47 +03:00
|
|
|
ln net.Listener
|
|
|
|
host string
|
|
|
|
port int
|
|
|
|
mode string
|
|
|
|
sw *swift.Connection
|
|
|
|
user string
|
|
|
|
token string
|
|
|
|
path string
|
|
|
|
api string
|
|
|
|
passive bool
|
2015-05-06 16:15:39 +03:00
|
|
|
movesrc string
|
|
|
|
movedst string
|
2015-04-14 03:14:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Conn) Close() error {
|
|
|
|
return c.ctrl.Close()
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewServer(c net.Conn) (*Conn, error) {
|
2015-04-15 14:57:47 +03:00
|
|
|
return &Conn{api: "https://api.clodo.ru", user: "storage_21_1", token: "56652e9028ded5ea5d4772ba80e578ce", ctrl: textproto.NewConn(c), path: "/"}, nil
|
2015-04-14 03:14:38 +03:00
|
|
|
}
|