Comments (6)
直接在Endpoint那里加一个EndpointFromDomain吧
from flare.
getaddrinfo确实更好,gethostbyname被deprecate了
但是EndpointFromDomain有点奇怪,from ipv4/6这些都是工厂方法,而这个domain实际上是在做解析,可能失败可能返回多个,跟工厂性质已经不一样了。
optional<vector<Endpoint>> ResolveDomainName(string_view)
之类的可能比较合适。另外service参数感觉没啥必要,一方面现在很少有人用https之类的写法指定端口号,另一方面真的指定端口号的时候,这个service参数反而很难传。(另外就这个函数名来说的话,Domain name因为不涉及到端口,所以也不太适合有这个参数)
from flare.
嗯好,error code要返回吗
from flare.
嗯好,error code要返回吗
std::variant<std::vecotr<Endpoint>, int>
from flare.
getaddrinfo确实更好,gethostbyname被deprecate了
但是EndpointFromDomain有点奇怪,from ipv4/6这些都是工厂方法,而这个domain实际上是在做解析,可能失败可能返回多个,跟工厂性质已经不一样了。
optional<vector<Endpoint>> ResolveDomainName(string_view)
之类的可能比较合适。另外service参数感觉没啥必要,一方面现在很少有人用https之类的写法指定端口号,另一方面真的指定端口号的时候,这个service参数反而很难传。(另外就这个函数名来说的话,Domain name因为不涉及到端口,所以也不太适合有这个参数)
service还可以传"80", "12345"的端口字符串
from flare.
那用Expected<vector<…>, int>
好了
service那个一方面跟这个函数名不怎么搭(domain name的话不涉及port),一方面真用端口的话没有背景知识的人(用户一般不会关注底层实现)也不理解为什么类型不是int。
不过想了下,因为Endpoint不能手动改端口号,不允许指定端口号确实有点难用,那参数里加上int result_port=0
吧
from flare.
Related Issues (20)
- Http header data structure HOT 13
- Rpc: Http parse HOT 5
- 针对K8s容器环境是否有需要注意的优化配置呢 HOT 2
- clang-format HOT 15
- update blade HOT 9
- logging HOT 11
- if have any plan to support bazel HOT 1
- bazel build ... 失败 HOT 6
- 请问有合适的源码阅读顺序吗 HOT 5
- 对GetFreeCount的取值比较困惑 HOT 5
- Does the server example in the flare example support 1 thread start? HOT 4
- clang-17 asan/tsan fiber coredump
- 关于Function类的疑问 HOT 2
- 问一个非常诡异的用例 HOT 10
- 关于调度参数的疑问 HOT 1
- 编译时间太长 HOT 4
- 调试相关 HOT 3
- Fiber scheduling takes too long HOT 3
- 为什么侵入式的链表采用的是组合而不是继承? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flare.