mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 21:30:16 +02:00
fix options
This commit is contained in:
parent
fa1b2af314
commit
837a66e975
4 changed files with 17 additions and 5 deletions
6
src/cleanup.go
Normal file
6
src/cleanup.go
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
package croc
|
||||||
|
|
||||||
|
func (c *Croc) cleanup() {
|
||||||
|
// TODO
|
||||||
|
// erase all the croc files and their possible numbers
|
||||||
|
}
|
|
@ -58,7 +58,8 @@ func (c *Croc) client(role int, codePhrase string, fname ...string) (err error)
|
||||||
// connect to the websocket
|
// connect to the websocket
|
||||||
// TODO:
|
// TODO:
|
||||||
// use predefined host and HTTPS, if exists
|
// use predefined host and HTTPS, if exists
|
||||||
u := url.URL{Scheme: "ws", Host: "localhost:8003", Path: "/"}
|
|
||||||
|
u := url.URL{Scheme: strings.Split(c.WebsocketAddress, "://")[0], Host: strings.Split(c.WebsocketAddress, "://")[1], Path: "/"}
|
||||||
log.Debugf("connecting to %s", u.String())
|
log.Debugf("connecting to %s", u.String())
|
||||||
ws, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
|
ws, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -216,6 +216,7 @@ func (c *Croc) processReceivedFile() (err error) {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
os.Remove(c.crocFile)
|
||||||
c.cs.channel.finishedHappy = true
|
c.cs.channel.finishedHappy = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,13 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Croc struct {
|
type Croc struct {
|
||||||
TcpPorts []string
|
// Options for connecting to server
|
||||||
ServerPort string
|
TcpPorts []string
|
||||||
Timeout time.Duration
|
WebsocketAddress string
|
||||||
|
ServerPort string
|
||||||
|
Timeout time.Duration
|
||||||
|
|
||||||
|
// Options for file transfering
|
||||||
UseEncryption bool
|
UseEncryption bool
|
||||||
UseCompression bool
|
UseCompression bool
|
||||||
CurveType string
|
CurveType string
|
||||||
|
@ -41,12 +45,12 @@ type Croc struct {
|
||||||
func Init() (c *Croc) {
|
func Init() (c *Croc) {
|
||||||
c = new(Croc)
|
c = new(Croc)
|
||||||
c.TcpPorts = []string{"27001", "27002", "27003", "27004"}
|
c.TcpPorts = []string{"27001", "27002", "27003", "27004"}
|
||||||
c.ServerPort = "8003"
|
|
||||||
c.Timeout = 10 * time.Minute
|
c.Timeout = 10 * time.Minute
|
||||||
c.UseEncryption = true
|
c.UseEncryption = true
|
||||||
c.UseCompression = true
|
c.UseCompression = true
|
||||||
c.AllowLocalDiscovery = true
|
c.AllowLocalDiscovery = true
|
||||||
c.CurveType = "p521"
|
c.CurveType = "p521"
|
||||||
|
c.WebsocketAddress = "ws://localhost:8003"
|
||||||
c.rs.Lock()
|
c.rs.Lock()
|
||||||
c.rs.channel = make(map[string]*channelData)
|
c.rs.channel = make(map[string]*channelData)
|
||||||
c.cs.channel = new(channelData)
|
c.cs.channel = new(channelData)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue