@@ -7,33 +7,18 @@ defer {
7
7
try ! group. syncShutdownGracefully ( )
8
8
}
9
9
10
-
11
-
12
- // We need a host key. We can generate a fixed one or generate one on the fly
13
- //let key = Curve25519.Signing.PrivateKey()
14
- //let keyData = key.rawRepresentation
15
- //let keyDataBase64 = keyData.base64EncodedString()
16
- //print(keyDataBase64)
17
-
18
10
let fixedKeyBase64b = " UIL9M6Utw/jiupzqq6F8EW4qySxAbgDS+wT7/RIjkJ4= "
19
11
let fixedKeyData = Data ( base64Encoded: fixedKeyBase64b) !
20
12
let hostKey = NIOSSHPrivateKey ( ed25519Key: try ! . init( rawRepresentation: fixedKeyData) )
21
13
22
14
let bootstrap = ServerBootstrap ( group: group)
23
- //.serverChannelOption(ChannelOptions.backlog, value: 256)
24
- //.serverChannelOption(ChannelOptions.socketOption(.so_reuseaddr), value: 1)
25
-
26
15
27
16
// Pipeline
28
17
. childChannelInitializer { channel in
29
18
channel. pipeline. addHandlers ( [ NIOSSHHandler ( role: . server( . init( hostKeys: [ hostKey] , userAuthDelegate: NoLoginDelegate ( ) , globalRequestDelegate: MUDGlobalRequestDelegate ( ) ) ) , allocator: channel. allocator, inboundChildChannelInitializer: sshChildChannelInitializer ( _: _: ) ) , ErrorHandler ( ) ] )
30
19
}
31
20
. serverChannelOption ( ChannelOptions . socket ( SocketOptionLevel ( SOL_SOCKET) , SO_REUSEADDR) , value: 1 )
32
21
. serverChannelOption ( ChannelOptions . socket ( SocketOptionLevel ( IPPROTO_TCP) , TCP_NODELAY) , value: 1 )
33
- // .childChannelOption(ChannelOptions.recvAllocator, value: AdaptiveRecvByteBufferAllocator())
34
- // .childChannelOption(ChannelOptions.socketOption(.so_reuseaddr), value: 1)
35
- // .childChannelOption(ChannelOptions.maxMessagesPerRead, value: 16)
36
- // .childChannelOption(ChannelOptions.recvAllocator, value: AdaptiveRecvByteBufferAllocator())
37
22
38
23
let host = ProcessInfo . processInfo. environment [ " NIOSWIFTMUD_HOSTNAME " ] ?? " ::1 "
39
24
let port = Int ( ProcessInfo . processInfo. environment [ " NIOSWIFTMUD_PORT " ] ?? " 2222 " ) ?? 2222
0 commit comments