于 2014年08月28日 23:51, johnzeng 写道: > Hi , i have a switch , and i hope to redirect video traffic to Cache via > using Port mirroring feature , and monitoring network traffic that > involves forwarding a copy of > > each packet from one network switch. > > > Whether Squid 2.7 can listen and identify mirroring data packet ? > > if Squid 2.7 can identify , i hope to match video part and send 302 http > packet to end user via url_rewrite_access and redirect the user's > request to Cache > > Whether my thought is correct way ? > > > Or Whether we can realize the goal via dansguardian + squid or > squidguard + squid or icap +squid .... ? > > if possible , please help me . > > > *********************************************** > > url_rewrite_program /cache/video_operation > url_rewrite_children 10 > > acl location_rewrite_video url_regex -i > ^http://[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\/video\/.*\.(m4v|flv|mp4|wmv|rm|ram|mov|avi|mp3)\?nk= > > url_rewrite_access allow location_rewrite_video > > 这是part program of video_operation > > int video(string *domain, string *urlf) > { > if(regexMatch("^http://[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\/video/", > *urlf)){ > if(regexMatch("\\.(flv|mp4)$",*urlf) || > regexMatch("\\.(flv|mp4)\\?start=", *urlf)){ > *urlf = "http://192.168.2.6/video/" + get_foldername(*urlf, 1) + "/" + > get_filename(*urlf); > } else if (regexMatch("\\.(flv|mp4)\\?special=true$",*urlf)) { > //redirect sphotos and photos-[a-z] to the same url > *urlf = *domain +"/" + ".video/" + get_foldername(*urlf, 1) + "/" + > get_filename(*urlf) + "?special=true"; > } > else if (regexMatch("\\.(flv|mp4)\\?nk=",*urlf)) { //redirect sphotos > and photos-[a-z] to the same url > *urlf = "302:http://192.168.2.6/video/" + get_foldername(*urlf, 1) + "/" > + get_filename(*urlf); > } > return 1; > } > return 0; > } >