mirror of
				https://github.com/MHSanaei/3x-ui.git
				synced 2025-11-04 06:12:52 +00:00 
			
		
		
		
	IPLimit - IPv4 Extraction Simplification
This commit is contained in:
		
							parent
							
								
									1207501405
								
							
						
					
					
						commit
						d171850255
					
				
					 1 changed files with 5 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -115,13 +115,13 @@ func (j *CheckClientIpJob) processLogFile() {
 | 
			
		|||
	for scanner.Scan() {
 | 
			
		||||
		line := scanner.Text()
 | 
			
		||||
 | 
			
		||||
		ipRegx, _ := regexp.Compile(`[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+`)
 | 
			
		||||
		ipRegx, _ := regexp.Compile(`(\d+\.\d+\.\d+\.\d+).* accepted`)
 | 
			
		||||
		emailRegx, _ := regexp.Compile(`email:.+`)
 | 
			
		||||
 | 
			
		||||
		matchesIp := ipRegx.FindString(line)
 | 
			
		||||
		if len(matchesIp) > 0 {
 | 
			
		||||
			ip := string(matchesIp)
 | 
			
		||||
			if ip == "127.0.0.1" || ip == "1.1.1.1" {
 | 
			
		||||
		matches := ipRegx.FindStringSubmatch(line)
 | 
			
		||||
		if len(matches) > 1 {
 | 
			
		||||
			ip := matches[1]
 | 
			
		||||
			if ip == "127.0.0.1" || ip == "[::1]" {
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -136,7 +136,6 @@ func (j *CheckClientIpJob) processLogFile() {
 | 
			
		|||
					continue
 | 
			
		||||
				}
 | 
			
		||||
				InboundClientIps[matchesEmail] = append(InboundClientIps[matchesEmail], ip)
 | 
			
		||||
 | 
			
		||||
			} else {
 | 
			
		||||
				InboundClientIps[matchesEmail] = append(InboundClientIps[matchesEmail], ip)
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue