-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
39 lines (31 loc) · 959 Bytes
/
main.go
File metadata and controls
39 lines (31 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"crypto/tls"
"flag"
"fmt"
"thrift-blobfuse/client"
"thrift-blobfuse/server"
"github.com/apache/thrift/lib/go/thrift"
)
func main() {
isServer := flag.Bool("server", false, "Run server")
addr := flag.String("addr", "localhost:9090", "Address to listen to")
secure := flag.Bool("secure", false, "Use tls secure transport")
flag.Parse()
var protocolFactory thrift.TProtocolFactory = thrift.NewTBinaryProtocolFactoryConf(nil)
cfg := &thrift.TConfiguration{
TLSConfig: &tls.Config{
InsecureSkipVerify: true,
},
}
var transportFactory thrift.TTransportFactory = thrift.NewTTransportFactory()
if *isServer {
if err := server.RunServer(transportFactory, protocolFactory, *addr, *secure); err != nil {
fmt.Println("error running server:", err)
}
} else {
if err := client.RunClient(transportFactory, protocolFactory, *addr, *secure, cfg); err != nil {
fmt.Println("error running client:", err)
}
}
}