File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
_examples/shttp/fileserver Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ build: scion-bat \
17
17
scion-sensorfetcher scion-sensorserver \
18
18
scion-ssh scion-sshd \
19
19
example-helloworld \
20
- example-shttp-client example-shttp-server example-shttp-proxy
20
+ example-shttp-client example-shttp-server example-shttp-fileserver example-shttp- proxy
21
21
22
22
clean :
23
23
go clean ./...
@@ -98,6 +98,10 @@ example-shttp-client:
98
98
example-shttp-server :
99
99
go build -o $(BIN ) /$@ ./_examples/shttp/server
100
100
101
+ .PHONY : example-shttp-fileserver
102
+ example-shttp-fileserver :
103
+ go build -o $(BIN ) /$@ ./_examples/shttp/fileserver
104
+
101
105
.PHONY : example-shttp-proxy
102
106
example-shttp-proxy :
103
107
go build -o $(BIN ) /$@ ./_examples/shttp/proxy
Original file line number Diff line number Diff line change
1
+ // Copyright 2020 ETH Zurich
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ // example-shttp-fileserver is a simple HTTP fileserver that serves all files
16
+ // and subdirectories under the current working directory.
17
+ package main
18
+
19
+ import (
20
+ "flag"
21
+ "fmt"
22
+ "log"
23
+ "net/http"
24
+
25
+ "github.com/netsec-ethz/scion-apps/pkg/shttp"
26
+ )
27
+
28
+ func main () {
29
+ port := flag .Uint ("p" , 443 , "port the server listens on" )
30
+ flag .Parse ()
31
+
32
+ handler := http .FileServer (http .Dir ("" ))
33
+ log .Fatal (shttp .ListenAndServe (fmt .Sprintf (":%d" , * port ), handler , nil ))
34
+ }
You can’t perform that action at this time.
0 commit comments