File tree 3 files changed +32
-5
lines changed
3 files changed +32
-5
lines changed Original file line number Diff line number Diff line change @@ -381,15 +381,11 @@ func (c *ServerConn) Stor(path string, r io.Reader) error {
381
381
// Hint: io.Pipe() can be used if an io.Writer is required.
382
382
func (c * ServerConn ) StorFrom (path string , r io.Reader , offset uint64 ) error {
383
383
384
- fmt .Println ("Getting new data conn" )
385
-
386
384
conn , err := c .cmdDataConnFrom (offset , "STOR %s" , path )
387
385
if err != nil {
388
386
return err
389
387
}
390
388
391
- fmt .Println ("Attempting to copy" )
392
-
393
389
n , err := io .Copy (conn , r )
394
390
395
391
if err != nil {
Original file line number Diff line number Diff line change 5
5
"context"
6
6
"flag"
7
7
"fmt"
8
+ "github.com/elwin/scionFTP/scion"
8
9
"io"
9
10
"log"
10
11
"os"
@@ -30,6 +31,7 @@ func main() {
30
31
"mode" : app .mode ,
31
32
"get" : app .retr ,
32
33
"put" : app .stor ,
34
+ "mkdir" : app .mkdir ,
33
35
"quit" : app .quit ,
34
36
}
35
37
@@ -110,6 +112,8 @@ func (app *App) connect(args []string) {
110
112
111
113
app .conn = conn
112
114
115
+ app .conn .SetPathSelector (scion .NewRotator (10 ).PathSelector )
116
+
113
117
ctx , cancel := context .WithCancel (app .ctx )
114
118
app .cancel = cancel
115
119
@@ -176,6 +180,19 @@ func (app *App) cd(args []string) {
176
180
}
177
181
}
178
182
183
+ func (app * App ) mkdir (args []string ) {
184
+ if len (args ) != 1 {
185
+ app .print ("Must supply one argument for directory name" )
186
+ return
187
+ }
188
+
189
+ err := app .conn .MakeDir (args [0 ])
190
+ if err != nil {
191
+ app .print (err )
192
+ return
193
+ }
194
+ }
195
+
179
196
func (app * App ) pwd (args []string ) {
180
197
cur , err := app .conn .CurrentDir ()
181
198
if err != nil {
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ package scion
2
2
3
3
import (
4
4
"fmt"
5
+ "github.com/scionproto/scion/go/lib/log"
6
+ "os/user"
5
7
"sync"
6
8
7
9
"github.com/scionproto/scion/go/lib/snet/squic"
@@ -12,7 +14,14 @@ import (
12
14
13
15
var initialize sync.Once
14
16
17
+ const (
18
+ KEYPATH = "/go/src/github.com/scionproto/scion/gen-certs/tls.key"
19
+ PEMPATH = "/go/src/github.com/scionproto/scion/gen-certs/tls.pem"
20
+ )
21
+
15
22
func initNetwork (local Address ) error {
23
+ log .SetupLogConsole ("info" )
24
+
16
25
var err error
17
26
initialize .Do (func () {
18
27
if snet .DefNetwork == nil {
@@ -24,7 +33,12 @@ func initNetwork(local Address) error {
24
33
}
25
34
}
26
35
27
- err := squic .Init ("" , "" )
36
+ user , err := user .Current ()
37
+ if err != nil {
38
+ return
39
+ }
40
+
41
+ err = squic .Init (user .HomeDir + KEYPATH , user .HomeDir + PEMPATH )
28
42
if err != nil {
29
43
err = fmt .Errorf ("failed to initilaze SQUIC: %s" , err )
30
44
return
You can’t perform that action at this time.
0 commit comments