Golang lib for doing layer 2 bridges

agolangf · · 1157 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I rigged a little library for setting up layer 2 tunnels in Linux using golang and have been using it for a while, so I thought I would share and also ask for some tips. Right now, much of the heavy lifting is in C because I never figured out how to properly perform IOCTLs using go. Any one have some good examples of crafting a struct for the kernel where the memory lays out correctly?</p> <p>If you don&#39;t mind enabling CGO it works as is.</p> <p>Link: <a href="https://github.com/traetox/goTunTap">https://github.com/traetox/goTunTap</a></p> <p>HUGE GIANT CAVEAT! There is an example application in the repo called a &#34;VPN&#34; that does some totally un-vetted crypto and auth. It is an example. FOR THE LOVE OF ALL THAT IS HOLY DO NOT USE IT IN IMPORTANT PLACES!</p> <hr/>**评论:**<br/><br/>rjik: <pre><blockquote> <p>Right now, much of the heavy lifting is in C because I never figured out how to properly perform IOCTLs using go.</p> </blockquote> <pre><code>r1, r2, errno := syscall.Syscall(syscall.SYS_IOCTL, ...) </code></pre> <p>Relevant thread: <a href="https://groups.google.com/forum/#!topic/golang-nuts/LTlOwzcn470">https://groups.google.com/forum/#!topic/golang-nuts/LTlOwzcn470</a></p></pre>traetox: <pre><p>Nice. I&#39;ll remove the cgo and update.</p></pre>pursuit92: <pre><p>The syscall lib is deprecated, you should use the sys library instead: <a href="https://github.com/golang/sys" rel="nofollow">https://github.com/golang/sys</a></p></pre>beefsack: <pre><p>I&#39;d not heard it was deprecated, and can&#39;t find anything regarding that after doing some searching, do you have a source?</p></pre>alecticwp: <pre><p>details: <a href="https://docs.google.com/document/d/1QXzI9I1pOfZPujQzxhyRy6EeHYTQitKKjHfpq0zpxZs/edit" rel="nofollow">https://docs.google.com/document/d/1QXzI9I1pOfZPujQzxhyRy6EeHYTQitKKjHfpq0zpxZs/edit</a></p></pre>pursuit92: <pre><p>Check the docs for the syscall library; it&#39;s in the Overview: <a href="http://golang.org/pkg/syscall/" rel="nofollow">http://golang.org/pkg/syscall/</a></p></pre>PaulCapestany: <pre><p>Perhaps this might be useful? <a href="https://github.com/kowsik/l2bridge" rel="nofollow">https://github.com/kowsik/l2bridge</a></p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

1157 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传