chringo
Goto Top

Proxy.pac - Ich brauche Input

Ich bräuchte zu folgender Proxy.pac ein wenig Input.
Was für eine Sprache ist das?
Was passiert hier wo genau ?
Im Allgemeinen, versteh ich ja, was hier passiert. Da ich aber bald Prüfung habe, wäre es superlieb wenn mir hier jemand
ein paar genauere Informationen geben könnte.


1 function FindProxyForURL(url,host)
2 {set bm1 and bm2 to the 2 proxies
3 var bm1="10.100.50.81"
4 var bm2="10.100.50.83"
5
find the 4th octet - if even, is bm1/bm2 else bm2/bm1
6 var myip=myIpAddress()
7 var ipbits=myip.split(".")
8 var myseg=parseInt(ipbits[3])
9 if(myseg==Math.floor(myseg/2)*2) {
10 var proxone=bm1
11 var proxtwo=bm2
12 }
13 else {
14 var proxone=bm2
15 var proxtwo=bm1
16 }
17 if name has no dots, or is our domain, or starts 10., or if my
18
current address does not start 10. don't use proxy
22 host.substring(0,3)=="10." )
23 {
24 alert("direct")
25 return "DIRECT";
26 }
27 else {
28
alert("proxy")
29 return "PROXY "+proxone+":8080; PROXY "+proxtwo+":8080" ;
30 }}

Content-ID: 36040

Url: https://administrator.de/forum/proxy-pac-ich-brauche-input-36040.html

Ausgedruckt am: 10.04.2025 um 10:04 Uhr

stiehl
stiehl 14.07.2006 um 20:29:03 Uhr
Goto Top
Das ist normales JavaScript.

Eine kleine Übersicht über die Möglichkeiten, die du mit einer .pac-Datei hast, gibt dir folgende Seite:

http://www.selflinux.org/selflinux/html/squid08.html
Biber
Biber 14.07.2006 um 20:49:34 Uhr
Goto Top
Moin chringo,
wie eben schon gepostet, ist das irgendeine Skriptsprache. Und somit Code.
Den musst Du hier beim Posten als
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 formatieren. Sonst werden z.B. die internen Formatierungsanweisungen "Doppelslash" als "Mach mir das in kursiv" interpretiert und nicht abgedruckt als Code-Kommentare, die zum Skript gehören.   

Besser also so:
 1   function FindProxyForURL(url,host)
 2   {// set bm1 and bm2 to the 2 proxies
 3   var bm1="10.100.50.81"  
 4   var bm2="10.100.50.83"  
 5   //find the 4th octet - if even, is bm1/bm2 else bm2/bm1
 6   var myip=myIpAddress()
 7   var ipbits=myip.split(".")  
 8   var myseg=parseInt(ipbits[3])
 9   if(myseg==Math.floor(myseg/2)*2) {
10   var proxone=bm1
11   var proxtwo=bm2
12  }
13 else {
14   var proxone=bm2
15   var proxtwo=bm1
16  }
17  //if name has no dots, or is our domain, or starts 10., or if my
18  //current address does not start 10. don't use proxy 
19  if(isPlainHostName(host)  ||
20   dnsDomainIs(host,".mydomain.co.uk") ||  
21  myip.substring(0,3)!=="10." ||  
22  host.substring(0,3)=="10." )  
23  {
24  // alert("direct")	 
25  return "DIRECT";  
26  }
27	else {
28  //  alert("proxy") 
29	return "PROXY "+proxone+":8080; PROXY "+proxtwo+":8080" ;  
30  }}

Unten in den "ähnlichen Beiträgen" stehen auch mehrere Links zu ..na ja, Fast-Tutorials.
Ein ganz einleuchtendes ist (IMHO) http://nscsysop.hypermart.net/proxypac.html

Gruß
Biber