ing
This commit is contained in:
		
							parent
							
								
									2da8c2ca47
								
							
						
					
					
						commit
						187ef708f6
					
				| @ -1,3 +1,4 @@ | |||||||
| package: git.loafle.net/commons_go/server | package: git.loafle.net/commons_go/server | ||||||
| import: | import: | ||||||
| - package: git.loafle.net/commons_go/logging | - package: git.loafle.net/commons_go/logging | ||||||
|  | - package: gopkg.in/natefinch/npipe.v2 | ||||||
|  | |||||||
							
								
								
									
										9
									
								
								ipc/ipc.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								ipc/ipc.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | |||||||
|  | package ipc | ||||||
|  | 
 | ||||||
|  | import "git.loafle.net/commons_go/server" | ||||||
|  | 
 | ||||||
|  | type ServerHandlers struct { | ||||||
|  | 	server.ServerHandlers | ||||||
|  | 
 | ||||||
|  | 	path string | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								ipc/ipc_unix.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								ipc/ipc_unix.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | |||||||
|  | package ipc | ||||||
|  | 
 | ||||||
|  | import ( | ||||||
|  | 	"net" | ||||||
|  | 	"os" | ||||||
|  | 	"path/filepath" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | func (sh *ServerHandlers) Listen() (net.Listener, error) { | ||||||
|  | 	sh.path = filepath.Join(os.TempDir(), sh.Addr) | ||||||
|  | 	if err := os.Remove(sh.path); nil != err { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	return net.ListenUnix("unix", &net.UnixAddr{Name: sh.path, Net: "unix"}) | ||||||
|  | } | ||||||
							
								
								
									
										13
									
								
								ipc/ipc_windows.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								ipc/ipc_windows.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | |||||||
|  | package ipc | ||||||
|  | 
 | ||||||
|  | import ( | ||||||
|  | 	"net" | ||||||
|  | 
 | ||||||
|  | 	"gopkg.in/natefinch/npipe.v2" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | func (sh *ServerHandlers) Listen() (net.Listener, error) { | ||||||
|  | 	sh.path = `\\.\pipe\` + sh.Addr | ||||||
|  | 
 | ||||||
|  | 	return npipe.Listen(s.path) | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								tcp/tcp.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								tcp/tcp.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | |||||||
|  | package tcp | ||||||
|  | 
 | ||||||
|  | import ( | ||||||
|  | 	"net" | ||||||
|  | 
 | ||||||
|  | 	"git.loafle.net/commons_go/server" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | type ServerHandlers struct { | ||||||
|  | 	server.ServerHandlers | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (sh *ServerHandlers) Listen() (net.Listener, error) { | ||||||
|  | 
 | ||||||
|  | 	return net.Listen("tcp", sh.Addr) | ||||||
|  | } | ||||||
							
								
								
									
										19
									
								
								tcp_tls/tcp_tls.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								tcp_tls/tcp_tls.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | |||||||
|  | package tcp_tls | ||||||
|  | 
 | ||||||
|  | import ( | ||||||
|  | 	"crypto/tls" | ||||||
|  | 	"net" | ||||||
|  | 
 | ||||||
|  | 	"git.loafle.net/commons_go/server" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | type ServerHandlers struct { | ||||||
|  | 	server.ServerHandlers | ||||||
|  | 
 | ||||||
|  | 	tlsConfig *tls.Config | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (sh *ServerHandlers) Listen() (net.Listener, error) { | ||||||
|  | 
 | ||||||
|  | 	return tls.Listen("tcp", sh.Addr, sh.tlsConfig) | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user