File tree 2 files changed +21
-2
lines changed
2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ Executable codeworld-game-bot
49
49
bytestring,
50
50
text,
51
51
websockets >= 0.12.3.0 ,
52
+ wuss,
52
53
codeworld-game-api,
53
54
codeworld-api,
54
55
async,
Original file line number Diff line number Diff line change @@ -33,9 +33,24 @@ import Options.Applicative
33
33
import System.Clock
34
34
import Text.Read
35
35
import Text.Regex
36
+ import qualified Wuss as Wuss
36
37
37
38
connect :: Config -> WS. ClientApp a -> IO a
38
- connect (Config {.. }) = WS. runClient hostname port path
39
+ connect (Config {.. })
40
+ | secure =
41
+ Wuss. runSecureClientWith
42
+ hostname
43
+ (fromIntegral port)
44
+ path
45
+ WS. defaultConnectionOptions
46
+ [(" Host" , BS. pack hostname)]
47
+ | otherwise =
48
+ WS. runClientWith
49
+ hostname
50
+ port
51
+ path
52
+ WS. defaultConnectionOptions
53
+ [(" Host" , BS. pack hostname)]
39
54
40
55
type Timestamp = Double
41
56
@@ -132,6 +147,7 @@ timeSpecToS ts = fromIntegral (sec ts) + fromIntegral (nsec ts) * 1E-9
132
147
data Config = Config
133
148
{ clients :: Int ,
134
149
invert :: Bool ,
150
+ secure :: Bool ,
135
151
delay :: Maybe Double ,
136
152
hostname :: String ,
137
153
port :: Int ,
@@ -159,6 +175,8 @@ opts =
159
175
)
160
176
<*> switch
161
177
(long " invert" <> showDefault <> help " Return opposite direction" )
178
+ <*> switch
179
+ (long " secure" <> short ' s' <> help " Use a secure connection" )
162
180
<*> optional
163
181
( option
164
182
auto
@@ -178,7 +196,7 @@ opts =
178
196
<> help " Port"
179
197
)
180
198
<*> strOption
181
- ( long " path" <> showDefault <> metavar " PATH" <> value " gameserver"
199
+ ( long " path" <> showDefault <> metavar " PATH" <> value " / gameserver"
182
200
<> help " Path"
183
201
)
184
202
<*> optional
You can’t perform that action at this time.
0 commit comments