Skip to content

Commit b95c51c

Browse files
committed
Merge branch 'master' into tr_graph
2 parents 9ae5f1d + da762fd commit b95c51c

File tree

35 files changed

+3653
-691
lines changed

35 files changed

+3653
-691
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@ roughtime/timeserver/timeserver
5656

5757
# vscode workspace
5858
*.code-workspace
59+
60+
# IntelliJ IDEA workspace
61+
.idea/

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ all: $(TARGETS)
99
deps:
1010
./deps.sh
1111

12+
vendor: deps
13+
1214
clean:
1315
@$(foreach d,$(SRCDIRS),cd $(ROOT_DIR)/$(d) && go clean;)
1416

17+
mrproper: clean
18+
rm -rf vendor/*/
19+
1520
install: all
1621
@$(foreach d,$(SRCDIRS), cd $(ROOT_DIR)/$(d); cp $(shell basename $(d)) ~/go/bin;)
1722

bat/bat.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func init() {
121121
}
122122

123123
// redirect SCION log to a log file
124-
slog.SetupLogFile("scion", "log", "debug", 10, 10, 0)
124+
slog.SetupLogFile("scion", "log", "debug", 10, 10, 0, 0)
125125
}
126126

127127
func parsePrintOption(s string) {

bwtester/bwtestclient/bwtestclient.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ func main() {
336336
}
337337

338338
var pathEntry *sciond.PathReplyEntry
339-
if !serverCCAddr.IA.Eq(clientCCAddr.IA) {
339+
if !serverCCAddr.IA.Equal(clientCCAddr.IA) {
340340
if interactive {
341341
pathEntry = scionutil.ChoosePathInteractive(clientCCAddr, serverCCAddr)
342342
} else {
@@ -373,7 +373,7 @@ func main() {
373373
L3: serverCCAddr.Host.L3, L4: addr.NewL4UDPInfo(uint16(serverPort) + 1)}}
374374

375375
// Set path on data connection
376-
if !serverDCAddr.IA.Eq(clientDCAddr.IA) {
376+
if !serverDCAddr.IA.Equal(clientDCAddr.IA) {
377377
serverDCAddr.Path = spath.New(pathEntry.Path.FwdPath)
378378
serverDCAddr.Path.InitOffsets()
379379
serverDCAddr.NextHop, _ = pathEntry.HostInfo.Overlay()

bwtester/bwtestserver/bwtestserver.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/scionproto/scion/go/lib/addr"
2323
"github.com/scionproto/scion/go/lib/sciond"
2424
"github.com/scionproto/scion/go/lib/snet"
25+
"github.com/scionproto/scion/go/lib/sock/reliable"
2526
)
2627

2728
func printUsage() {
@@ -149,7 +150,7 @@ func runServer() {
149150
*sciondPath = sciond.GetDefaultSCIONDPath(nil)
150151
}
151152
log.Info("Starting server")
152-
snet.Init(serverCCAddr.IA, *sciondPath, *dispatcherPath)
153+
snet.Init(serverCCAddr.IA, *sciondPath, reliable.NewDispatcherService(*dispatcherPath))
153154

154155
serverISDASIP := fmt.Sprintf("%s,[%s]", serverCCAddr.IA, serverCCAddr.Host.L3)
155156

camerapp/imagefetcher/imagefetcher.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/netsec-ethz/scion-apps/lib/scionutil"
1616
"github.com/scionproto/scion/go/lib/sciond"
1717
"github.com/scionproto/scion/go/lib/snet"
18+
"github.com/scionproto/scion/go/lib/sock/reliable"
1819
)
1920

2021
const (
@@ -165,6 +166,7 @@ func main() {
165166
sciondPath string
166167
sciondFromIA bool
167168
dispatcherPath string
169+
outputFilePath string
168170

169171
err error
170172
local *snet.Addr
@@ -179,6 +181,7 @@ func main() {
179181
flag.BoolVar(&sciondFromIA, "sciondFromIA", false, "SCIOND socket path from IA address:ISD-AS")
180182
flag.StringVar(&dispatcherPath, "dispatcher", "/run/shm/dispatcher/default.sock",
181183
"Path to dispatcher socket")
184+
flag.StringVar(&outputFilePath, "output", "", "Path to the output file")
182185
flag.Parse()
183186

184187
// Create SCION UDP socket
@@ -205,7 +208,7 @@ func main() {
205208
} else if sciondPath == "" {
206209
sciondPath = sciond.GetDefaultSCIONDPath(nil)
207210
}
208-
snet.Init(local.IA, sciondPath, dispatcherPath)
211+
snet.Init(local.IA, sciondPath, reliable.NewDispatcherService(dispatcherPath))
209212
udpConnection, err = snet.DialSCION("udp4", local, remote)
210213
check(err)
211214

@@ -280,7 +283,10 @@ func main() {
280283
}
281284

282285
// Write file to disk
283-
err = ioutil.WriteFile(fileName, fileBuffer, 0600)
286+
if outputFilePath == "" {
287+
outputFilePath = fileName
288+
}
289+
err = ioutil.WriteFile(outputFilePath, fileBuffer, 0600)
284290
check(err)
285291
fmt.Println("\nDone, exiting. Total duration", time.Now().Sub(startTime))
286292
}

camerapp/imageserver/imageserver.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/scionproto/scion/go/lib/addr"
2020
"github.com/scionproto/scion/go/lib/sciond"
2121
"github.com/scionproto/scion/go/lib/snet"
22+
"github.com/scionproto/scion/go/lib/sock/reliable"
2223
)
2324

2425
const (
@@ -167,7 +168,7 @@ func main() {
167168
} else if sciondPath == "" {
168169
sciondPath = sciond.GetDefaultSCIONDPath(nil)
169170
}
170-
snet.Init(server.IA, sciondPath, dispatcherPath)
171+
snet.Init(server.IA, sciondPath, reliable.NewDispatcherService(dispatcherPath))
171172
udpConnection, err = snet.ListenSCION("udp4", server)
172173
check(err)
173174

deps.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
#!/bin/bash
2-
printf "\n### Getting dependencies ###\n"
2+
set -e
3+
4+
# version less or equal. E.g. verleq 1.9 2.0.8 == true (1.9 <= 2.0.8)
5+
verleq() {
6+
[ ! -z "$1" ] && [ ! -z "$2" ] && [ "$1" = `echo -e "$1\n$2" | sort -V | head -n1` ]
7+
}
8+
9+
V=$(go version | sed 's/^go version go\(.*\) .*$/\1/')
10+
if ! verleq 1.11.0 "$V"; then
11+
echo "Go version 1.11 or newer required"
12+
exit 1
13+
fi
14+
command -v govendor >/dev/null || go get github.com/kardianos/govendor
315
govendor sync -v
4-
printf "\n### Compiling capnp ###\n"
5-
cp vendor/zombiezen.com/go/capnproto2/std/go.capnp vendor/github.com/scionproto/scion/proto/go.capnp
6-
cd vendor/github.com/scionproto/scion/go/proto && make

helloworld/helloworld.go

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,30 +59,33 @@ func main() {
5959
// initialize SCION
6060
err = snet.Init(clientCCAddr.IA, sciondPath, dispatcherPath)
6161
Check(err)
62-
// query paths from here to there:
63-
pathMgr := snet.DefNetwork.PathResolver()
64-
pathSet := pathMgr.Query(context.Background(), clientCCAddr.IA, serverCCAddr.IA)
65-
if len(pathSet) == 0 {
66-
Check(fmt.Errorf("No paths"))
67-
}
68-
// print all paths. Also pick one path. Here we chose the path with least hops:
69-
i := 0
70-
minLength, argMinPath := 999, (*sciond.PathReplyEntry)(nil)
71-
fmt.Println("Available paths:")
72-
for _, path := range pathSet {
73-
fmt.Printf("[%2d] %d %s\n", i, len(path.Entry.Path.Interfaces)/2, path.Entry.Path.String())
74-
if len(path.Entry.Path.Interfaces) < minLength {
75-
minLength = len(path.Entry.Path.Interfaces)
76-
argMinPath = path.Entry
62+
63+
if !serverCCAddr.IA.Equal(clientCCAddr.IA) {
64+
// query paths from here to there:
65+
pathMgr := snet.DefNetwork.PathResolver()
66+
pathSet := pathMgr.Query(context.Background(), clientCCAddr.IA, serverCCAddr.IA, sciond.PathReqFlags{})
67+
if len(pathSet) == 0 {
68+
Check(fmt.Errorf("No paths"))
69+
}
70+
// print all paths. Also pick one path. Here we chose the path with least hops:
71+
i := 0
72+
minLength, argMinPath := 999, (*sciond.PathReplyEntry)(nil)
73+
fmt.Println("Available paths:")
74+
for _, path := range pathSet {
75+
fmt.Printf("[%2d] %d %s\n", i, len(path.Entry.Path.Interfaces)/2, path.Entry.Path.String())
76+
if len(path.Entry.Path.Interfaces) < minLength {
77+
minLength = len(path.Entry.Path.Interfaces)
78+
argMinPath = path.Entry
79+
}
80+
i++
7781
}
78-
i++
82+
fmt.Println("Chosen path:", argMinPath.Path.String())
83+
// we need to copy the path to the destination (destination is the whole selected path)
84+
serverCCAddr.Path = spath.New(argMinPath.Path.FwdPath)
85+
serverCCAddr.Path.InitOffsets()
86+
serverCCAddr.NextHop, _ = argMinPath.HostInfo.Overlay()
87+
// get a connection object using that path:
7988
}
80-
fmt.Println("Chosen path:", argMinPath.Path.String())
81-
// we need to copy the path to the destination (destination is the whole selected path)
82-
serverCCAddr.Path = spath.New(argMinPath.Path.FwdPath)
83-
serverCCAddr.Path.InitOffsets()
84-
serverCCAddr.NextHop, _ = argMinPath.HostInfo.Overlay()
85-
// get a connection object using that path:
8689
conn, err := snet.DialSCION("udp4", clientCCAddr, serverCCAddr)
8790
Check(err)
8891
defer conn.Close()

lib/scionutil/initialization.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/scionproto/scion/go/lib/addr"
2424
"github.com/scionproto/scion/go/lib/sciond"
2525
"github.com/scionproto/scion/go/lib/snet"
26+
"github.com/scionproto/scion/go/lib/sock/reliable"
2627
)
2728

2829
const localhost = "localhost"
@@ -60,8 +61,8 @@ func GetSCIONDPath(ia *addr.IA) string {
6061
}
6162

6263
// GetDefaultDispatcher returns the path to the default SCION dispatcher
63-
func GetDefaultDispatcher() string {
64-
return "/run/shm/dispatcher/default.sock"
64+
func GetDefaultDispatcher() reliable.DispatcherService {
65+
return reliable.NewDispatcherService("")
6566
}
6667

6768
// GetLocalhost returns a local SCION address an application can bind to

0 commit comments

Comments
 (0)