github.com/apernet/sing-tun@v0.2.6-0.20240323130332-b9f6511036ad/stack_run_patch.go (about)

     1  package tun
     2  
     3  type StackRunner interface {
     4  	Stack
     5  	Run() error
     6  }
     7  
     8  var _ StackRunner = (*System)(nil)
     9  
    10  func (s *System) Run() error {
    11  	err := s.Start()
    12  	defer s.Close()
    13  	if err != nil {
    14  		return err
    15  	}
    16  	return s.tunLoop()
    17  }