Ai
1 Star 0 Fork 0

qw_1215/glink

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 647 Bytes
一键复制 编辑 原始数据 按行查看 历史
qw_1215 提交于 2020-03-12 22:26 +08:00 . 项目初始化
package main
import (
"fmt"
streams "gitee.com/qw_1215/glink"
si "gitee.com/qw_1215/glink/extension/sink"
so "gitee.com/qw_1215/glink/extension/source"
"gitee.com/qw_1215/glink/flow"
"strings"
)
// Test producer: nc -u 127.0.0.1 3434
// Test 订阅: nc -u -l 3535
func main() {
source, err := so.NewNetSource(so.UDP, "127.0.0.1:3434")
streams.Check(err)
flow1 := flow.NewMap(toUpper, 1)
sink, err := si.NewNetSink(si.ConnType(so.UDP), "127.0.0.1:3535")
streams.Check(err)
source.Via(flow1).To(sink)
}
var toUpper = func(in interface{}) interface{} {
msg := in.(string)
fmt.Printf("Got: %s\n", msg)
return strings.ToUpper(msg)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/qw_1215/glink.git
git@gitee.com:qw_1215/glink.git
qw_1215
glink
glink
195e12e86392

搜索帮助