This repository was archived by the owner on Feb 24, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +15
-1
lines changed
Expand file tree Collapse file tree 4 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ func DownRun(r *cmd.Root, c *cmd.Sub) {
5252
5353 // Different types of systems may need the tun devices destroyed first or
5454 // the process to exit first don't worry as long as one of these two has
55- // suceeded .
55+ // succeeded .
5656 if err0 != nil && err1 != nil {
5757 checkErr (err0 )
5858 checkErr (err1 )
Original file line number Diff line number Diff line change @@ -301,6 +301,9 @@ func createDaemon(cfg *config.Config) error {
301301 fmt .Println (line .Text )
302302 if strings .HasPrefix (line .Text , "[+] Connection to" ) {
303303 numConnected ++
304+ if numConnected >= len (cfg .Peers ) {
305+ break
306+ }
304307 }
305308 }
306309 out <- numConnected
Original file line number Diff line number Diff line change 11package tun
22
3+ // Option defines a TUN device modifier option.
34type Option func (tun * TUN ) error
45
6+ // Address sets the local address and subnet for an interface.
7+ // On MacOS devices use this function to set the Src Address
8+ // for an interface and use DestAddress to set the destination ip.
59func Address (address string ) Option {
610 return func (tun * TUN ) error {
711 return tun .setAddress (address )
812 }
913}
1014
15+ // MTU sets the Maximum Transmission Unit size for an interface.
1116func MTU (mtu int ) Option {
1217 return func (tun * TUN ) error {
1318 return tun .setMTU (mtu )
1419 }
1520}
1621
22+ // DestAddress sets the destination address for a point-to-point interface.
23+ // Only use this option on MacOS devices.
1724func DestAddress (address string ) Option {
1825 return func (tun * TUN ) error {
1926 return tun .setDestAddress (address )
Original file line number Diff line number Diff line change @@ -2,13 +2,17 @@ package tun
22
33import "github.com/songgao/water"
44
5+ // TUN is a struct containing the fields necessary
6+ // to configure a system TUN device. Access the
7+ // internal TUN device through TUN.Iface
58type TUN struct {
69 Iface * water.Interface
710 MTU int
811 Src string
912 Dst string
1013}
1114
15+ // Apply configures the specified options for a TUN device.
1216func (t * TUN ) Apply (opts ... Option ) error {
1317 for _ , opt := range opts {
1418 if opt == nil {
You can’t perform that action at this time.
0 commit comments