如何使用 SSLSetALPNProtocols?

How do I make use of SSLSetALPNProtocols?

我正在为 vapor 项目开发 TLS 库,并支持 Apple 的(传输)安全和 OpenSSL 以用于 HTTP/2 客户端和服务器。

On this line of code 我正在尝试呼叫 SSLSetALPNProtocols。不管我的方法如何,我在那行代码中遇到了 ld 链接器错误。

Undefined symbols for architecture x86_64:
  "_SSLSetALPNProtocols", referenced from:
      __T08AppleSSL9SSLOptionV4alpnACSaySSG9protocols_tFZySo10SSLContextCKcfU_ in Options.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

没有可用的文档来强调可能的明显错误 since the page is empty

那么,如何让此代码在 ALPN 支持下进行编译?

目前这是不可能的。 Apple 忘记导出 SSLSetALPNProtocolsSSLCopyALPNProtocols 函数。

我已经提交了 rdar://34790589(rdar://33907676 的副本)

从最新的 macOS 和 Xcode 测试版开始,Swift 4.1 我已经搞定了 运行。