File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,12 @@ func NewConnection(config *AppConfig) (*Connection, error) {
72
72
c .UseStdout = config .UseStdout
73
73
c .Yes = config .Yes
74
74
c .rate = config .Rate
75
+ c .Local = config .Local
76
+
77
+ if c .Local {
78
+ c .Yes = true
79
+ c .DontEncrypt = true
80
+ }
75
81
76
82
stat , _ := os .Stdin .Stat ()
77
83
if (stat .Mode () & os .ModeCharDevice ) == 0 {
@@ -268,7 +274,9 @@ func (c *Connection) Run() error {
268
274
}
269
275
}
270
276
271
- go func () { runClientError <- c .runClient (c .Server ) }()
277
+ if ! c .Local {
278
+ go func () { runClientError <- c .runClient (c .Server ) }()
279
+ }
272
280
return <- runClientError
273
281
}
274
282
@@ -304,10 +312,11 @@ func (c *Connection) runClient(serverName string) error {
304
312
connection , err := net .Dial ("tcp" , serverName + ":" + port )
305
313
if err != nil {
306
314
if serverName == "cowyo.com" {
307
- fmt .Println ( "\n Check http://bit.ly/croc-relay to see if the public server is down or contact the webmaster: @yakczar" )
315
+ fmt .Fprintf ( os . Stderr , "\n Check http://bit.ly/croc-relay to see if the public server is down or contact the webmaster: @yakczar" )
308
316
} else {
309
317
fmt .Fprintf (os .Stderr , "\n Could not connect to relay %s\n " , serverName )
310
318
}
319
+ fmt .Fprintf (os .Stderr , "Use --local to run locally" )
311
320
os .Exit (1 )
312
321
}
313
322
defer connection .Close ()
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ type AppConfig struct {
20
20
DontEncrypt bool `yaml:"no-encrypt" flagName:"no-encrypt" flagSName:"g" flagDescribe:"Turn off encryption" default:"false"`
21
21
UseStdout bool `yaml:"stdout" flagName:"stdout" flagSName:"o" flagDescribe:"Use stdout" default:"false"`
22
22
Yes bool `yaml:"yes" flagName:"yes" flagSName:"y" flagDescribe:"Automatically accept file" default:"false"`
23
+ Local bool `yaml:"local" flagName:"local" flagSName:"lo" flagDescribe:"Use local relay when sending" default:"false"`
23
24
Server string `yaml:"server" flagName:"server" flagSName:"l" flagDescribe:"Croc relay to use" default:"cowyo.com"`
24
25
File string `yaml:"send" flagName:"send" flagSName:"s" flagDescribe:"File to send default:""`
25
26
Path string `yaml:"save" flagName:"save" flagSName:"p" flagDescribe:"Path to save to" default:""`
You can’t perform that action at this time.
0 commit comments