You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							19 lines
						
					
					
						
							307 B
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							19 lines
						
					
					
						
							307 B
						
					
					
				| package net2 | |
| 
 | |
| import ( | |
| 	"net" | |
| 	"strconv" | |
| ) | |
| 
 | |
| // Returns the port information. | |
| func GetPort(addr net.Addr) (int, error) { | |
| 	_, lport, err := net.SplitHostPort(addr.String()) | |
| 	if err != nil { | |
| 		return -1, err | |
| 	} | |
| 	lportInt, err := strconv.Atoi(lport) | |
| 	if err != nil { | |
| 		return -1, err | |
| 	} | |
| 	return lportInt, nil | |
| }
 |